On Mon, 8 Dec 2003 11:45:10, Richard Coutts asks: >Before allocating dynamic memory I do a check to insure that there's enough >memory to allocate and still leave some left over for the system and the >app. > >My question is: Is there a rule of thumb as to how much Dynamic Memory to >keep free? E.g., 10% of total available on the device? I have a limited >number of devices to test on, so I can't do too much experimentation for >this.
I don't know the official answer, but for OS 3.1 and earlier, my applications try to leave at least 2.5k of dynamic heap free for use by any OS calls (or "hacks" running underneath OS traps); for OS 3.5 and later, at least 4k free. This seems to be enough for some of my applications dynamic forms, but, of course, for your particular application and environment, YMMV. If you also want the bits behind your dialogs and menus to be saved, you can calculate this additional amount, which depends on your dialog dimensions, display depth and native resolution. An application has to check for amount of dynamic heap available, as this can vary from under 12kB to over 6 MB, depending on OS version, display depth, and whether any network or communication stacks are running Gremlin testing is always advisable. But one needs to leave more dynamic heap free than just that required by Gremlin testing if one want to play polite with unknown "hacks" or notification manager sublaunch calls which the user may have running. IMHO. YMMV. Ron Nicholson HotPaw Productions http://www.hotpaw.com/rhn/palm -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
