Category: Language-Implementation
Superclass: Object
I provide a few methods that enable one to tune the virtual machine's usage of memory. In addition, I can signal to my dependants some `events' that can happen during the virtual machine's life. ObjectMemory has both class-side and instance-side methods. In general, class-side methods provide means to tune the parameters of the memory manager, while instance-side methods are used together with the #current class-side method to take a look at statistics on the memory manager's state.

Method category index

accessing (class)
builtins (class)
initialization (class)
saving the image (class)
accessing (instance)
builtins (instance)
derived information (instance)

accessing (class)

current
Return a snapshot of the VM's memory management statistics.

top


builtins (class)

abort
Quit the Smalltalk environment, dumping core.

addressOf: anObject

Returns the address of the actual object that anObject references. Note that, with the exception of fixed objects this address is only valid until the next garbage collection; thus it's pretty risky to count on the address returned by this method for very long.

addressOfOOP: anObject

Returns the address of the OOP (object table slot) for anObject. The address is an Integer and will not change over time (i.e. is immune from garbage collector action) except if the virtual machine is stopped and restarted.

bigObjectThreshold

Answer the smallest size for objects that are allocated outside the main heap in the hope of providing more locality of reference between small objects.

bigObjectThreshold: bytes

Set the smallest size for objects that are allocated outside the main heap in the hope of providing more locality of reference between small objects. bytes must be a positive SmallInteger.

compact

Force a full garbage collection, including compaction of oldspace

finishIncrementalGC

Do a step in the incremental garbage collection.

gcMessage

Answer whether messages indicating that garbage collection is taking place are printed on stdout

gcMessage: aBoolean

Set whether messages indicating that garbage collection is taking place are printed on stdout

globalGarbageCollect

Force a full garbage collection

growThresholdPercent

Answer the percentage of the amount of memory used by the system grows which has to be full for the system to allocate more memory

growThresholdPercent: growPercent

Set the percentage of the amount of memory used by the system grows which has to be full for the system to allocate more memory

growTo: numBytes

Grow the amount of memory used by the system grows to numBytes.

incrementalGCStep

Do a step in the incremental garbage collection.

quit

Quit the Smalltalk environment. Whether files are closed and other similar cleanup occurs depends on the platform

quit: exitStatus

Quit the Smalltalk environment, passing the exitStatus integer to the OS. Files are closed and other similar cleanups occur.

scavenge

Force a minor garbage collection

smoothingFactor

Answer the factor (between 0 and 1) used to smooth the statistics provided by the virtual machine about memory handling. 0 disables updating the averages, 1 disables the smoothing (the statistics return the last value).

smoothingFactor: rate

Set the factor (between 0 and 1) used to smooth the statistics provided by the virtual machine about memory handling. 0 disables updating the averages, 1 disables the smoothing (the statistics return the last value).

spaceGrowRate

Answer the rate with which the amount of memory used by the system grows

spaceGrowRate: rate

Set the rate with which the amount of memory used by the system grows

top


initialization (class)

changed: aSymbol
Not commented.

initialize

Initialize the globals

top


saving the image (class)

snapshot
Save a snapshot on the image file that was loaded on startup.

snapshot: aString

Save an image on the aString file

top


accessing (instance)

allocFailures
Answer the number of times that the old-space allocator found no block that was at least as big as requested, and had to ask the operating system for more memory.

allocMatches

Answer the number of times that the old-space allocator found a block that was exactly as big as requested.

allocProbes

Answer the number of free blocks that the old-space allocator had to examine so far to allocate all the objects that are in old-space

allocSplits

Answer the number of times that the old-space allocator could not find a block that was exactly as big as requested, and had to split a larger free block in two parts.

bytesPerOOP

Answer the number of bytes that is taken by an ordinary object pointer (in practice, a field such as a named instance variable).

bytesPerOTE

Answer the number of bytes that is taken by an object table entry (in practice, the overhead incurred by every object in the system, with the sole exception of SmallIntegers).

edenSize

Answer the number of bytes in the `eden' area of the young generation (in practice, the number of allocated bytes between two scavenges).

edenUsedBytes

Answer the number of bytes that are currently filled in the `eden' area of the young generation.

fixedSpaceSize

Answer the number of bytes in the special heap devoted to objects that the garbage collector cannot move around in memory.

fixedSpaceUsedBytes

Answer the number of bytes that are currently filled in the special heap devoted to objects that the garbage collector cannot move around in memory.

numCompactions

Answer the number of oldspace compactions that happened since the VM was started.

numFixedOOPs

Answer the number of objects that the garbage collector cannot move around in memory.

numFreeOTEs

Answer the number of entries that are currently free in the object table.

numGlobalGCs

Answer the number of global garbage collections (collection of the entire heap) that happened since the VM was started.

numGrowths

Answer the number of times that oldspace was grown since the VM was started.

numOTEs

Answer the number of entries that are currently allocated for the object table.

numOldOOPs

Answer the number of objects that reside in the old generation.

numScavenges

Answer the number of scavenges (fast collections of the young generation) that happened since the VM was started.

numWeakOOPs

Answer the number of weak objects that the garbage collector is currently tracking.

oldSpaceSize

Answer the number of bytes in the old generation.

oldSpaceUsedBytes

Answer the number of bytes that are currently filled in the old generation.

reclaimedBytesPerGlobalGC

Answer the average number of bytes that are found to be garbage during a global garbage collections.

reclaimedBytesPerScavenge

Answer the average number of bytes that are found to be garbage during a scavenge.

reclaimedPercentPerScavenge

Answer the average percentage of allocated bytes that are found to be garbage during a scavenge. If this number falls below 60-70 you should definitely increment the size of the eden, because you risk that scavenging is eating a considerable fraction of your execution time; do the measurement on a restarted image, so that the extra tenuring incurred when creating long-lived objects such as classes or methods is not considered.

survSpaceSize

Answer the number of bytes in the `survivor' area of the young generation (the area to which young objects are relocated during scavenges).

survSpaceUsedBytes

Answer the number of bytes that are currently filled in the `survivor' area of the young generation.

tenuredBytesPerScavenge

Answer the average number of bytes that are promoted to oldspace during a scavenge.

timeBetweenGlobalGCs

Answer the average number of milliseconds between two global garbage collections.

timeBetweenGrowths

Answer the average number of milliseconds between decisions to grow the heap.

timeBetweenScavenges

Answer the average number of milliseconds between two scavenges (fast collections of the young generation).

timeToCollect

Answer the average number of milliseconds that a global garbage collection takes.

timeToCompact

Answer the average number of milliseconds that compacting the heap takes. This the same time that is taken by growing the heap.

timeToScavenge

Answer the average number of milliseconds that a scavenge takes (fast collections of the young generation).

top


builtins (instance)

update
Update the values in the object to the current state of the VM.

top


derived information (instance)

scavengesBeforeTenuring
Answer the number of scavenges that an object must on average survive before being promoted to oldspace; this is however only an estimate because objects that are reachable from oldspace have a higher probability to be tenured soon, while objects that are only reachable from thisContext have a lower probability to be tenured. Anyway, if this number falls below 2-3 you should definitely increment the size of eden and/or of survivor space, because you are tenuring too often and relying too much on global garbage collection to keep your heap clean; do the measurement on a restarted image, so that the extra tenuring incurred when creating long-lived objects such as classes or methods is not considered.

top