[squeak-dev] how/where is memory returned to the OS?

Igor Stasenko siguctua at gmail.com
Fri Oct 19 21:41:54 UTC 2012

On 19 October 2012 21:42, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> On Fri, Oct 19, 2012 at 11:31 AM, Chris Muller <ma.chris.m at gmail.com> wrote:
>> >> I have an image which needed to allocate 500MB of memory for a large
>> >> operation.  Now that operation is done and all objects have been
>> >> reclaimed.  According to VM I am now only using 200MB.
>> >>
>> >>   (Smalltalk vmParameterAt: 2) max: (Smalltalk vmParameter at: 1)
>> >> "221923374"
>> >>
>> >> However, when I look at my VM process in "top" or the System Monitor,
>> >> it still says its >500MB.
>> >>
>> >> How does this work?
>> >
>> > Depends on the platform.  On Mac OS X memory is not returned. On Windows
>> > memory is allocated and freed via VirtualAlloc and VirtualFree.  On Unix
>> > memory is allocated and returned via mmap and munmap by default.  What
>> > OS
>> > are you on?  Looks like the unix code could be ported to the Mac easily.
>> Linux chrisT520 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09
>> UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
>> So, after several hours top still shows >500MB.  Will it ever go back
>> down to the level reported by vm-parameters [1,2 or 3]?
> I'm not sure.  It all depends on the useMmap variable in the linux vm.  If
> it is non-zero then a cursory reading of the source says that yes, the
> memory should be returned.

I may be mistaken. But what i have seen, there is no way release
address space back to OS.
It is not because platform code do not releasing the memory, but it is
because VM never does that.

At least , last time i looked at that code, it was like that.

Also,  can i remind you (It been a while since i wrote about that.. ),
what i told before that we need a better memory manager:
the existing one is less than adequate for modern systems.
The model, which it employs (reserving huge amount of address space,
for instance) does not works
well for HydraVM..
because if you reserve 512M address space per interpreter instance,
you cannot have more than 4-8 (depending on system) at once..

> --
> best,
> Eliot

Best regards,
Igor Stasenko.

More information about the Squeak-dev mailing list