writeImageFile() without snapshot()?
avi.bryant at gmail.com
Thu Oct 13 18:05:57 UTC 2005
On Oct 7, 2005, at 5:37 PM, Andreas Raab wrote:
> Avi -
> Try this: Instead of "self fullGC" in primSnapshot, try inserting:
> "DISCLAIMER: This requires some careful review which I
> don't have the time for right now. This is NOT working
> or tested code so don't even think of submitting this
> to VMMaker unless you actually understand why this ought
> to work and what differences there possibly might be
> between a full GC and an incremental GC + tenuring."
> savedThreshold := tenuringThreshold. "remember prior threshold"
> tenuringThreshold := 0. "reset tenuring threshold"
> self incrementalGC. "force tenuring"
> tenuringThreshold := savedThreshold.
> This may already be enough since tenuring will clean up the roots
> and thus leave the image in a stable state. But of course, it does
> require the image to perform a full GC if you want to reclaim space
> before the snapshot.
For what it's worth (probably not much) I've been running for the
last several days with this in place, along with a fork before
writing out the image, and haven't seen any ill effects. Here's the
full #snapshot: I'm using:
"update state of active context"
| activeProc dataSize rcvr setMacType savedThreshold |
ifTrue: [self compilerPreSnapshot]
ifFalse: [self storeContextRegisters: activeContext].
"update state of active process"
activeProc _ self fetchPointer: ActiveProcessIndex ofObject:
"compact memory and compute the size of the memory actually in use"
"DISCLAIMER: This requires some careful review which I
don't have the time for right now. This is NOT working
or tested code so don't even think of submitting this
to VMMaker unless you actually understand why this ought
to work and what differences there possibly might be
between a full GC and an incremental GC + tenuring."
savedThreshold _ tenuringThreshold. "remember prior threshold"
tenuringThreshold _ 0. "reset tenuring threshold"
self incrementalGC. "force tenuring"
tenuringThreshold _ savedThreshold.
dataSize _ freeBlock - self startOfMemory. "Assume all objects
are below the start of the free block"
ifTrue: [rcvr _ self popStack.
self push: trueObj.
(self cCode: 'fork()') = 0 ifTrue: [self writeImageFile:
dataSize. self cCode: '_exit(0)'].
ifFalse: ["set Mac file type and creator; this is a
noop on other platforms"
setMacType _ self ioLoadFunction:
'setMacFileTypeAndCreator' From: 'FilePlugin'.
setMacType = 0
ifFalse: [self cCode: '((int (*) (char*,
char*, char*)) setMacType) (getImageName(), "STim", "FAST")']].
self pop: 1].
"activeContext was unmarked in #snapshotCleanUp, mark it old "
self beRootIfOld: activeContext.
ifTrue: [self push: falseObj]
ifFalse: [self push: rcvr].
ifTrue: [self compilerPostSnapshot]
More information about the Squeak-dev