GC root table overflows.

Scott A Crosby crosby at qwes.math.cmu.edu
Thu Sep 27 09:29:02 UTC 2001


I've never had a root table overflow when I've used squeak, so this isn't
important to me. (Though one of my queue's I was working on would have
have faced this issue; my redesign has, among other things eliminated
this.)  But some of you may have them frequently, If so, then a change
along one of these lines this makes them at least 20x cheaper.


I think that instead of doing a full GC, do an incremental GC and tenure
the results immediately. Looking over the code, this seems to be easy, if
its OK to do an incremental GC from within:

ObjectMemory>>noteAsRoot:headerLoc:

Is it? If so, then having the above function trigger an incremental GC,
then tenure should work. If not, then just tenuring all of the objects
should also work.

Here are the changes (Note that I've not tested these yet):

--------

incrementalGC
	"Do a mark/sweep garbage collection of just the young object area
of
	object memory (i.e., objects above youngStart), using the root
table to
	identify objects containing pointers to young objects from the old
object
	area."
	| survivorCount startTime |
	self inline: false.
	DoAssertionChecks
		ifTrue: [self reverseDisplayFrom: 8 to: 15].
	DoAssertionChecks
		ifTrue: [self validateRoots].
	self preGCAction: false.
	"incremental GC and compaction"
	startTime _ self ioMicroMSecs.
	self markPhase.
	survivorCount _ self sweepPhase.
	self incrementalCompaction.
	allocationCount _ 0.
	statIncrGCs _ statIncrGCs + 1.
	statIncrGCMSecs _ statIncrGCMSecs + (self ioMicroMSecs -
startTime).
	rootTableCount >= RootTableSize | (survivorCount >
tenuringThreshold)
		ifTrue: ["Either a root table overflow; do an incremental
GC and
			immediately
			tenure"
			"Or, too many survivors, so move up the young
space boundary;
			this limits the number of objects that must be
processed on
			future incremental GC's"
			statTenures _ statTenures + 1.
			self clearRootsTable.
			youngStart _ freeBlock].
	self postGCAction.
	DoAssertionChecks
		ifTrue: [self reverseDisplayFrom: 8 to: 15]

--------------

noteAsRoot: oop headerLoc: headerLoc
	"Record that the given oop in the old object area points to an
object in
	the young area.
	HeaderLoc is usually = oop, but may be an addr in a forwarding
block."
	| header |
	self inline: true.
	header _ self longAt: headerLoc.
	(header bitAnd: RootBit)
			= 0
		ifTrue: ["record oop as root only if not already recorded"
			rootTableCount < RootTableSize
				ifTrue: ["record root only if there is
room in the roots table"
					rootTableCount _ rootTableCount +
1.
					rootTable at: rootTableCount put:
oop.
					self
						longAt: headerLoc
						put: (header bitOr:
RootBit)]
				ifFalse: [self incrementalGC]]





--
No DVD movie will ever enter the public domain, nor will any CD. The last CD
and the last DVD will have moldered away decades before they leave copyright.
This is not encouraging the creation of knowledge in the public domain.





More information about the Squeak-dev mailing list