ObjMem.st
changeset 379 5b5a130ccd09
parent 375 e5019c22f40e
child 384 cc3d110ea879
--- a/ObjMem.st	Thu Aug 10 14:14:29 1995 +0200
+++ b/ObjMem.st	Thu Aug 10 14:32:31 1995 +0200
@@ -34,7 +34,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.49 1995-08-08 00:47:48 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.50 1995-08-10 12:29:44 claus Exp $
 '!
 
 !ObjectMemory class methodsFor:'documentation'!
@@ -55,7 +55,8 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.49 1995-08-08 00:47:48 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.50 1995-08-10 12:29:44 claus Exp $
+$Revision: 1.50 $
 "
 !
 
@@ -1619,7 +1620,7 @@
      This is called by the ProcessorScheduler at idle times or by the 
      backgroundCollector."
 
-    |done limit free amount|
+    |done limit|
 
     limit := IncrementalGCLimit.
     (limit notNil and:[self oldSpaceAllocatedSinceLastGC > limit]) ifTrue:[
@@ -2150,31 +2151,67 @@
 %}.
 !
 
-lockTenure:aBoolean
+lockTenure:flag
     "set/clear the tenureLock. If the lock is set, the system
      completely turns off tenuring, and objects remain in newSpace (forever).
-     The system will completely operatate in the newSpace and no memory 
-     allocations from oldSpace are allowed, once this lock is
-     set (except for explicit tenure calls). 
+     Once this lock is set, the system operates only in the newSpace and no memory 
+     allocations from oldSpace are allowed (except for explicit tenure calls). 
      If any allocation request cannot be resoved, the VM raises a memory interrupt,
-     clears the flag and returns nil. This, it automatically falls back into
-     the normal mode of operation, to avoid big trouble (fail to allocate memory
-     when handling the exception).
+     clears the lockTenure-flag and returns nil. Thus, it automatically falls back into
+     the normal mode of operation, to avoid big trouble 
+     (fail to allocate memory when handling the exception).
 
      This interface can be used in applications, which are guaranteed to have their
      working set completely in the newSpace AND want to limit the worst case
-     pause times to the worst case scavenge time (which itself is limitd by the
-     size of the newSpace). 
+     pause times to the worst case scavenge time 
+     (which itself is limitd by the size of the newSpace). 
      I.e. systems which go into some event loop after initial startup,
      may turn on the tenureLock to make certain that no oldSpace memory is 
-     allocated in the future; thereby limiting any GC activity to newSpace 
-     scavenges only."
+     allocated in the future; thereby limiting any GC activity to newSpace scavenges only.
+
+     This is an EXPERIMENTAL interface.
+    "
 
 %{
-    if (aBoolean == true) {
+    if (flag == true) {
 	__tenure(__context);
     }
-    __lockTenure(aBoolean == true ? 1 : 0);
+    __lockTenure(flag == true ? 1 : 0);
+%}
+!
+
+avoidTenure:flag
+    "set/clear the avoidTenure flag. If set, aging of newSpace is turned off
+     as long as the newSpace fill-grade stays below some magic high-water mark.
+     If off (the default), aging is done as usual.
+     If the flag is turned on, scavenge may be a bit slower, due to more
+     objects being copied around. However, chances are high that in an idle
+     or (almost idle) system, less objects are moved into oldSpace.
+     Therefore, this helps to avoid oldSpace colelcts, in systems which go into
+     some standby mode and are reactivated by some external event.
+     (the avoid-flag should be turned off there, and set again once the idle loop
+     is reentered).
+
+    This is an EXPERIMENTAL interface."
+
+%{  /* NOCONTEXT */
+    __avoidTenure(flag == true ? 1 : 0);
+%}
+!
+
+watchTenure:flag
+    "set/clear the tenureWatch. If set, an internalError exception will be raised,
+     whenever objects are tenured from newSpace into oldSpace
+     (except for an explicit tenure request). 
+     This can be used to validate that no oldSpace objects are created
+     (i.e. the system operates fully in newSpace). 
+     Be careful, if the avoidTenure flag is not set, 
+     there will almost always be a tenure sooner or later.
+
+    EXPERIMENTAL - no warranty"
+
+%{  /* NOCONTEXT */
+    __watchTenure(flag == true ? 1 : 0);
 %}
 !
 
@@ -2387,6 +2424,15 @@
     ^ true
 ! !
 
+!ObjectMemory class methodsFor:'statistics'!
+
+ageStatistic
+%{   /* NOCONTEXT */
+
+    __ageStatistics();
+%}
+! !
+
 !ObjectMemory class methodsFor:'low memory handling'!
 
 memoryInterrupt
@@ -2591,7 +2637,9 @@
     }
 %}.
     ^ ok
-!
+! !
+
+!ObjectMemory class ignoredMethodsFor:'system management'!
 
 applicationImageOn:aFileName for:startupClass selector:startupSelector
     "create a snapshot which will come up without any views