[Vm-dev] Fwd: Only ever grows? (was: Re: [squeak-dev] how/where is
memory returned to the OS?)
Igor Stasenko
siguctua at gmail.com
Mon Oct 22 03:52:38 UTC 2012
This topic belongs to this list.
---------- Forwarded message ----------
From: Igor Stasenko <siguctua at gmail.com>
Date: 22 October 2012 05:36
Subject: Re: Only ever grows? (was: Re: [squeak-dev] how/where is
memory returned to the OS?)
To: ma.chris.m at gmail.com, The general-purpose Squeak developers list
<squeak-dev at lists.squeakfoundation.org>
On 22 October 2012 04:35, Chris Muller <asqueaker at gmail.com> wrote:
>> Unfortunately there is no easy fix , which will fit all possible use scenarios.
>> As you can see from comments in code, this feature was disabled on purpose
>> for cases when your application works extensively with external
>> resources/libraries,
>> which using malloc() a lot.
>
> You mean FFI? Someone took the trouble to write this for the manpage.
> My gut thinks FFI has been around longer than the releasing of memory
> feature -- not sure.
>
> -mmap size[mk]
> requests that a variable heap of at most size bytes be allo‐
> cated. (The suffixes are as described for the '-memory'
> option.) squeak will initially allocate a heap that is large
> enough to hold the image, with a small amount of headroom. If
> at any time Squeak requires more memory for its image then addi‐
> tional space will be allocated dynamically. Likewise, when mem‐
> ory is no longer needed it will deallocated and returned to the
> system. The size argument places an upper limit on how big the
> heap can grow in this fashion. squeak uses a dynamic heap by
> default with the maximum size set to 75% of the available vir‐
> tual memory or 1 gigabyte, whichever is smaller.
>
> Eliot, is the useMmap variable you referred to set by this argument?
> I tried launching my image with -mmap 700M but it still didn't seem to
> want to deallocate.
>
> Same with the Classic VM.
>
It is controlled by overallocateMemory flag,
which is not exposed via command-line options.
Here the patched file.
I added a new option -releaseUnusedMemory to turn this flag on.
I didn't tried to build VM with it, so don't blame me if it doesn't works :)
diff --git a/platforms/unix/vm/sqUnixMain.c b/platforms/unix/vm/sqUnixMain.c
index a593b2a..875bf0d 100644
--- a/platforms/unix/vm/sqUnixMain.c
+++ b/platforms/unix/vm/sqUnixMain.c
@@ -98,6 +98,7 @@ static char **squeakArgVec= 0;
static int extraMemory= 0;
int useMmap= DefaultMmapSize * 1024 * 1024;
+extern int overallocateMemory; /* defined in vm/sqUnixMemory.c */
static int useItimer= 1; /* 0 to disable itimer-based clock */
static int installHandlers= 1; /* 0 to disable sigusr1 &
sigsegv handlers */
@@ -1263,6 +1264,7 @@ static int vm_parseArgument(int argc, char **argv)
/* vm arguments */
if (!strcmp(argv[0], "-help")) { usage();
return 1; }
+ else if (!strcmp(argv[0], "-releaseUnusedMemory") {
overallocateMemory = 1; return 1; }
else if (!strcmp(argv[0], "-noevents")) { noEvents = 1;
return 1; }
else if (!strcmp(argv[0], "-nomixer")) { noSoundMixer = 1;
return 1; }
else if (!strcmp(argv[0], "-notimer")) { useItimer = 0;
return 1; }
--
Best regards,
Igor Stasenko.
--
Best regards,
Igor Stasenko.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqUnixMain.c
Type: text/x-csrc
Size: 53709 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20121022/35a90638/sqUnixMain-0001.c
More information about the Vm-dev
mailing list