Article # 583, added by Geoworks, historical record
| first | previous | index | next | last |

Fixed versus Movable memory block usage.



Q: Which type of memory is better to allocate, a movable
   or a fixed and locked block?

A: Movable is always better!

   The usual recommendation is for short-lived blocks to be alloced
   movable, even if they'll spend there entire lives locked down.

   The main reason for this is to reduce heap fragmentation. Fixed
   blocks get allocated at the bottom of the heap, and movable blocks
   get locked down at the top. By marking your block movable, once it
   has been freed, that free space will quickly be reused by other
   locked movable blocks.

   If another fixed block is allocated after yours, when your block is
   freed, it will leave a hole in the fixed memory area.