Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Some glob.c cleanups

On Jul 14,  4:10pm, Zoltan Hidvegi wrote:
} Subject: Some glob.c cleanups
} Also on some machines or on all machines with ZSH_MEM, this larege
} allocated heap area was not given back to the system after it was not
} needed, probably because the memory fragmented in a way that prevented
} this.

Just as a note:  I don't know of *any* malloc library that will compact
heap and return it to the system, no matter what allocation behavior
your application has.  Malloc maintains and re-uses its own internal
free list; when the free list doesn't contain a large-enough block for
a particular allocation, sbrk() is used to get more from the system,
but that new memory simply goes into the internal free list when freed.

Applications that release memory back to the system, like GNU emacs, use
their own heap allocation and compaction algorithms, and avoid malloc.
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@xxxxxxxxxx                  Division of NCD Software Corporation

Messages sorted by: Reverse Date, Date, Thread, Author