Instead of modifying the startup script you should change the localconfig value for mailboxd_java_heap_memory_percent to something suitable for your system. That value should then be retained during upgrades.
On a 32bit 4GB system it should be set to 37 or lower.
Code:
zmlocalconfig -e mailboxd_java_heap_memory_percent=37