what does primGarbageCollect return in Spur?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

what does primGarbageCollect return in Spur?

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

Reply | Threaded
Open this post in threaded view
|

Re: what does primGarbageCollect return in Spur?

Eliot Miranda-2
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 <[hidden email]> wrote:
Has anyone else noticed that flushing Monticello cached versions in
Spur no longer reports any memory freed up..?




--
best,
Eliot