From: MenTaLguY Date: 2007-10-19T05:06:18+09:00 Subject: Re: [OT] Re: Should *most* memory be release back to the system? On Fri, 19 Oct 2007 04:13:58 +0900, Joel VanderWerf wrote: > Yohanes Santoso wrote: >> mallopt(M_MMAP_THRESHOLD, 0); /* declared in malloc.h */ > > Very interesting. I'd like to use this as a diagnostic. > > I patched ruby's main.c to call mallopt() before anything else. It seems > to be using a huge amount of memory, though. Is this normal? Using mmap for individual allocations means that each allocation gets rounded up to the nearest multiple of the page size (typically 4k). That aside, I'm not sure it's that useful as a diagnostic; note that only M_MMAP_MAX chunks will ever be allocated at a time with mmap; further allocations beyond that are allocated the normal way by advancing sbrk. -mental