[Pharo-project] [Vm-dev] Problem with #garbageCollect and -memory parameter

David T. Lewis lewis at mail.msen.com
Tue Nov 30 17:14:49 CET 2010


I'm away and cannot check this right now, but if you look in the
SqS/VMMaker archive there there are a number of recent updates that
may address this problem. See the Montecello update comments for
VMMaker-dtl.188, VMMaker-dtl.199, and VMMaker-dtl.200 for summaries.
These updates would not be in any of the released VMs at this point,
but I have a hunch that they will take care of this problem.


On Tue, Nov 30, 2010 at 02:43:50PM +0100, Mariano Martinez Peck wrote:
> Hi folks. I am using the standard SqueakVM  4.2.5beta1U.
> If I run normaly the VM with a normal Pharo image and I print Smalltalk
> garbageCollect -> I get something like  492130460
> Now...if I run the vm with the parameter -memory 1500m  and I then print
> Smalltalk garbageCollect -> I get a NEGATIVE number like:  -619402660
> I guess there is a problem in somewhere like ObjectMemory >> bytesLeft:
> but I don't know...
> Anyway, the problem in my case is in SmalltalkImage:
> okayToProceedEvenIfSpaceIsLow
>     "Return true if either there is enough memory to do so safely or if the
> user gives permission after being given fair warning."
>     self garbageCollectMost > self lowSpaceThreshold ifTrue: [^ true].
> "quick"
>     self garbageCollect > self lowSpaceThreshold ifTrue: [^ true].  "work
> harder"
>     ^ self confirm:
> 'WARNING: There is not enough space to start the low space watcher.
> If you proceed, you will not be warned again, and the system may
> run out of memory and crash. If you do proceed, you can start the
> low space notifier when more space becomes available simply by
> opening and then closing a debugger (e.g., by hitting Cmd-period.)
> Do you want to proceed?'
> Since both of the first answers false because, of course garbageCollectMost
> and garbageCollect are negative....
> then I have that poup all the time.
> To fix this I have to posibilities:
> 1) Just patch this particular method to:
> self garbageCollectMost.
> self primBytesLeft > self lowSpaceThreshold ifTrue: [^ true].  "quick"
> self garbageCollect
> self primBytesLeft > self lowSpaceThreshold ifTrue: [^ true].  "work harder"
> Notice that primBytesLeft is answering correct. Wait..I don't know if
> correct, but at least possitive:  5691396
> I think this is possitive because the primitive is not receiving a
> parameter, and thus, Interpreter >> primitiveBytesLeft
> evaluates the first part of the method, which just does self sizeOfFree:
> freeBlock , and not the second part where it does self bytesLeft: aBool.
> 2) understand why it is negative and fix it from the VM side (I have no idea
> how to do this).
> Now, in addition, I wonder if there may be other places broken because of
> this....I am having some crashed and I don't know why :(
> Thanks in advance,
> Mariano

More information about the Pharo-project mailing list