On 11/19/07, John Stanton <[EMAIL PROTECTED]> wrote:

> Malloc is a concept implemented in various ways, some more successful
> than others but all of them hidden from the programmer.  Free tries to
> give back memory but as you can appreciate unless you use some garbage
> collection scheme with backwards pointers fragmentation and
> checkerboarding is very difficult to avoid.

Malloc and free as a concept do not imply fragmentation; it depends on
the implementation and how you use it.

> Various OS's have ways of allocating memory under control of the virtual
> memory manager so that it is not in the heap and can be completely
> returned.

This is no different than the malloc and free interface: you can
easily fragment virtual address space.

One form of allocator that is sometimes used in large task-oriented
programs is an arena-style one.  Essentially, a given task creates an
arena and performs malloc/free as necessary within the arena.  When
the task completes, the entire arena is destroyed, much like cleaning
up a stack.  Thus no memory-related issue such as fragmentation is
propagated between separate tasks.  It can be quite reliable when used
properly.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to