[Python-Dev] When do sets shrink?
Adal Chiriliuc
adal.chiriliuc at gmail.com
Thu Dec 29 01:41:10 CET 2005
On Thursday, December 29, 2005 "Martin v. Löwis" wrote:
> Noam Raphael wrote:
> In this specific case, perhaps. malloc will typically return memory to
> the system only if that memory is at the end of the heap. If there
> is more memory after block to be released, it can't return the memory
> block, because it won't punch a whole into the heap.
> So as soon as you have more than one object, things become interesting.
> Different systems use different, enhance strategies, of course. For
> example, Linux glibc malloc will allocate "large" blocks through
> mmap (instead of sbrk), such blocks then can be returned individually.
MSVC 7.1 and 8.0 malloc always uses the Windows heap functions
(HeapAlloc & friends) if running on Windows 2000 or newer
(malloc.c and heapinit.c).
So it seems that for both Linux (gcc) and Win (msvc) the memory is
released to the operating system.
Of course, fragmentation is still an issue, but now it's on the OS
side of things.
More information about the Python-Dev
mailing list