| rootObject filename commitThreshold | Transcript cr; show: 'Starting LOAD...'. filename := FileDirectory default pathName, '/deep.xml'. commitThreshold := 75. "Install AlmostOutOfMemory handler" Exception category: GemStoneError number: (ErrorSymbols at: #rtErrSignalAlmostOutOfMemory) do: [:ex :cat :num :args | "do a commit..." System commitTransaction ifFalse: [ nil error: 'AutoCommit failed' ]. Transcript show: '...AUTOCOMMIT...'. "run a markSweep, to see if we dropped below the threshold after the commit" System _vmMarkSweep. (System _tempObjSpacePercentUsedLastMark < commitThreshold) ifTrue: [ "if we did drop below the threshold, then reenable the signal" System enableAlmostOutOfMemoryError ]. "continue execution" ]. "Enable AlmostOutOfMemory signal" System signalAlmostOutOfMemoryThreshold: commitThreshold. [ | gsFile loadFile loadSixx str errorString | loadFile := true. loadSixx := true. loadFile ifTrue: [ Transcript cr; show: 'Opening file...'. gsFile := GsFile openRead: filename. gsFile == nil ifTrue: [ nil error: 'Error opening the file ', filename printString , ': ' , GsFile lastErrorString ]. UserGlobals at: #SIXX_LOAD_STRING put: String new. Transcript show: 'done' ]. loadSixx ifTrue: [ UserGlobals at: #SIXX_PERSISTENCE_ARRAY put: Array new ]. System commitTransaction ifFalse: [ nil error: 'Failed commit - setup' ]. loadFile ifTrue: [ Transcript cr; show: 'Loading file...'. [ str := gsFile next: 100000. str ~~ nil] whileTrue: [ Transcript show: '|'. (UserGlobals at: #SIXX_LOAD_STRING) add: str ]. (errorString := GsFile lastErrorString) ~~ nil ifTrue: [ nil error: 'Error reading file ', filename printString , ': ' , errorString ]. System commitTransaction ifFalse: [ nil error: 'Failed commit - string loaded' ]. gsFile fileSize ~~ (UserGlobals at: #SIXX_LOAD_STRING) size ifTrue: [ nil halt: 'uh oh' ]. Transcript show: 'done' ]. loadSixx ifTrue: [ Transcript cr; show: 'Reading SIXX...'. rootObject := Object readSixxFrom: (UserGlobals at: #SIXX_LOAD_STRING) persistentRoot: (UserGlobals at: #SIXX_PERSISTENCE_ARRAY). Transcript show: 'done']] ensure: [ "disable AlmostOutOfMemory signal" System signalAlmostOutOfMemoryThreshold: -1]. UserGlobals at: #SIXX_ROOT_OBJECT put: rootObject. System commitTransaction ifFalse: [ nil error: 'Failed commit - root object loaded' ]. Transcript cr; show: '...DONE WITH LOAD'.