--- a/ObjectMemory.st Tue Feb 21 15:41:32 2017 +0100
+++ b/ObjectMemory.st Tue Feb 21 15:42:43 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
@@ -2633,63 +2635,62 @@
run all the time, and therefore would prevent the idle-collector
from running. See documentation in this class for more details."
- |p|
-
self isSchteamEngine ifTrue:[^ self].
"/
"/ its not useful, to run it more than once
"/
BackgroundCollectProcess notNil ifTrue:[
- BackgroundCollectProcess priority:aPriority.
- ^ self
+ BackgroundCollectProcess priority:aPriority.
+ ^ self
].
- p :=
- [
- [
- |myDelay timeOfLastGC doGC|
-
- myDelay := Delay forSeconds:5.
- timeOfLastGC := Timestamp now.
-
- [true] whileTrue:[
- doGC := self gcStepIfUseful.
- doGC ifFalse:[
- (BackgroundCollectMaximumInterval notNil
- and:[(Timestamp now secondDeltaFrom: timeOfLastGC) > BackgroundCollectMaximumInterval])
- ifTrue:[
+ BackgroundCollectProcess :=
+ [
+ [
+ |myDelay timeOfLastGC doGC|
+
+ myDelay := Delay forSeconds:5.
+ timeOfLastGC := Timestamp now.
+
+ [ "loop"
+ doGC := self gcStepIfUseful.
+ doGC ifFalse:[
+ (BackgroundCollectMaximumInterval notNil
+ and:[(Timestamp now secondDeltaFrom: timeOfLastGC) > BackgroundCollectMaximumInterval])
+ ifTrue:[
"/ 'ObjectMemory [info]: start time-triggered background collect.' infoPrintCR.
- doGC := true.
- ]
- ].
-
- doGC ifTrue:[
- "/
- "/ perform a full cycle (finish cycle)
- "/
- [self gcStep] whileFalse:[].
- "/
- "/ increase oldSpace, if freeSpace is below limits.
- "/
- self moreOldSpaceIfUseful.
- timeOfLastGC := Timestamp now.
- ].
- "/
- "/ wait a bit
- "/
- myDelay wait.
- ]
- ] ifCurtailed:[
- BackgroundCollectProcess := nil
- ]
- ] newProcess.
- p name:'background collector'.
- p priority:aPriority.
- p restartable:true.
- p beSystemProcess.
- p resume.
- BackgroundCollectProcess := p
+ doGC := true.
+ ]
+ ].
+
+ doGC ifTrue:[
+ "/
+ "/ perform a full cycle (finish cycle)
+ "/
+ [self gcStep] whileFalse:[].
+ "/
+ "/ increase oldSpace, if freeSpace is below limits.
+ "/
+ self moreOldSpaceIfUseful.
+ BackgroundCollectMaximumInterval notNil ifTrue:[
+ timeOfLastGC := Timestamp now.
+ ].
+ ].
+ "/
+ "/ wait a bit
+ "/
+ myDelay wait.
+ ] loop.
+ ] ifCurtailed:[
+ BackgroundCollectProcess := nil
+ ]
+ ] newProcess
+ name:'background collector';
+ priority:aPriority;
+ restartable:true;
+ beSystemProcess;
+ resume.
"
the following lets the backgroundCollector run at prio 5
@@ -2705,10 +2706,11 @@
ObjectMemory incrementalGCLimit:100000.
ObjectMemory freeSpaceGCLimit:1000000.
- ObjectMemory startBackgroundCollectorAt:5.
- "
-
- "Modified: / 14.8.1998 / 13:09:19 / cg"
+ ObjectMemory startBackgroundCollectorAt:4.
+ "
+
+ "Modified: / 14-08-1998 / 13:09:19 / cg"
+ "Modified: / 21-02-2017 / 12:30:44 / stefan"
!
stopBackgroundCollector
@@ -4571,49 +4573,47 @@
system resources. Especially, you may temporarily run out of free
color table entries or fileDescriptors etc. Use at your own risk (if at all)"
- |p|
-
"/
"/ its not useful, to run it more than once
"/
BackgroundFinalizationProcess notNil ifTrue:[
- BackgroundFinalizationProcess priority:aPriority.
- ^ self
+ BackgroundFinalizationProcess priority:aPriority.
+ ^ self
].
FinalizationSemaphore := Semaphore new name:'FinalizationSemaphore'.
- p :=
- [
- [
- [true] whileTrue:[
- "
- wait till something to do ...
- "
- FinalizationSemaphore wait.
- "
- ... and do it
- "
- self finalize
- ]
- ] ifCurtailed:[
- BackgroundFinalizationProcess := nil.
- FinalizationSemaphore := nil
- ]
- ] newProcess.
- p name:'background finalizer'.
- p priority:aPriority.
- p restartable:true.
- p beSystemProcess.
- p resume.
- BackgroundFinalizationProcess := p
+ BackgroundFinalizationProcess :=
+ [
+ [
+ [
+ "
+ wait till something to do ...
+ "
+ FinalizationSemaphore wait.
+ "
+ ... and do it
+ "
+ self finalize
+ ] loop.
+ ] ifCurtailed:[
+ BackgroundFinalizationProcess := nil.
+ FinalizationSemaphore := nil
+ ]
+ ] newProcess
+ name:'background finalizer';
+ priority:aPriority;
+ restartable:true;
+ beSystemProcess;
+ resume.
"
ObjectMemory stopBackgroundFinalization.
ObjectMemory startBackgroundFinalizationAt:5
"
- "Modified: / 5.8.1998 / 14:53:27 / cg"
+ "Modified: / 05-08-1998 / 14:53:27 / cg"
+ "Modified: / 21-02-2017 / 12:19:19 / stefan"
!
stopBackgroundFinalization