[squeak-dev] what does primGarbageCollect return in Spur?

Eliot Miranda eliot.miranda at gmail.com
Mon Mar 23 16:56:53 UTC 2015


Hi Chris,

    in Spur, primitiveGarbageCollect answers the largest free chunk in
oldSpace, not the total free space.  This is done so
that handleFailingBasicNew: et al can determine whether memory should be
grown before an allocation is retried:

handleFailingBasicNew: sizeRequested
"handleFailingBasicNew: gets sent after basicNew: has failed and allowed
 a scavenging garbage collection to occur.  The scavenging collection
 will have happened as the VM is activating the (failing) basicNew:.  If
 handleFailingBasicNew: fails then the scavenge failed to reclaim sufficient
 space and a global garbage collection is required.  Retry after garbage
 collecting and growing memory if necessary.

 Primitive. Answer an instance of this class with the number of indexable
 variables specified by the argument, sizeRequested.  Fail if this class is
not
 indexable or if the argument is not a positive Integer, or if there is not
 enough memory available. Essential. See Object documentation
whatIsAPrimitive."

<primitive: 71>
| bytesRequested |
bytesRequested := self byteSizeOfInstanceOfSize: sizeRequested.
Smalltalk garbageCollect < bytesRequested ifTrue:
[Smalltalk growMemoryByAtLeast: bytesRequested].
"retry after global garbage collect and possible grow"
^self handleFailingFailingBasicNew: sizeRequested

Further, primBytesLeft answers the amount of free old space, excluding
newSpace entirely.  newSpace is continually changing its capacity as
allocation and scavenging continues, so IMO including that information
introduces noise.

But you point out that both methods should be commented accurately in
Spur.  I'll make it so.

On Mon, Mar 23, 2015 at 8:23 AM, Chris Muller <ma.chris.m at gmail.com> wrote:

> Has anyone else noticed that flushing Monticello cached versions in
> Spur no longer reports any memory freed up..?
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150323/482e9de0/attachment.htm


More information about the Squeak-dev mailing list