memory allocation on commandline
JohnMaloney at earthlink.net
Sun Jan 19 03:14:25 UTC 2003
I believe that, on the Mac, the memory parameter came from the the
"memory" setting in the application's "info" dialog, and it really did
mean the *total* amount of memory for that application. One could
argue that users shouldn't need to worry about such things, but
that's just the way the Mac worked before OS X.
I have no objection to changing what the "-memory" command
line option does on other platforms, but on Mac OS 8 and 9, I think
that the way it currently works matches what pre-X Mac users expect...
Ian and Andreas will probably have opinions about the *nix and Win32
VM's, but I seem to recall that "-memory" used to mean the total memory
allocation on these platforms as well, up through 2.8 at least...
>I recently got my nose rubbed in the fact that the memory heap
>allocation has changed a lot. I'm sure it used to (from the variable
>names and comments in my code) be that the parameter for '-memory:' was
>the amount of headroom for the image that the vm should try to allocate.
>Now the system is behaving as if that parameter is the _total_ memory to
>allocate. It didn't really make any difference to me most of the time
>because I have been running with 30Mb specified and that still left
>plenty of room even with recent images. However, a user of my vm (yes,
>Virginia, there are other Acorn users of Squeak out there) recently
>spotted the problem.
>Looking at the code for other platforms makes me think the change was a
>side effect of the memory grow/shrink work from quite some time ago. I
>think that in effect unix/w32/osx are relying upon the virtual memory &
>grow facilities to let it all kind-of work it out for itself. However
>I'm reasonably sure it could break if some small number were given for
>'-memory:'. The symptom would most likely be a 'error("Insufficient
>memory for this image") '.
>Now I'm sure we could live with it either way but it does seem to me
>that the sensible behaviour is for the 'memory parameter to be the spare
>room allocated. It makes little sense to have people specify XMb and
>then tell them 'guess again, that was not enough, sucker'. It's rude at
>best. There are of course many, many machines without virtual memory
>and/or with restrictive memory systems that are affected by this.
>I propse that the simple and effective answer would be to change the
>code in readImageFromFileHeapSizeStartingAt() to use:-
> heapSize = reserveExtraCHeapBytes(desiredHeapSize + dataSize,
>instead of the current:-
> heapSize = reserveExtraCHeapBytes(desiredHeapSize, extraVMMemory);
>Does anyone have any thoughts on the matter? Any reasons why
>specifying the total memory is better?
>Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
>Strange OpCodes: XER: Exclusive ERror
More information about the Squeak-dev