ObjMem.st
changeset 194 197c209e61f4
parent 178 4da1b10bf42c
child 202 40ca7cc6fb9c
--- a/ObjMem.st	Sat Oct 29 15:40:46 1994 +0100
+++ b/ObjMem.st	Sat Oct 29 15:41:03 1994 +0100
@@ -31,7 +31,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.16 1994-10-28 01:26:38 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.17 1994-10-29 14:41:03 claus Exp $
 '!
 
 !ObjectMemory class methodsFor:'documentation'!
@@ -52,7 +52,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.16 1994-10-28 01:26:38 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/ObjMem.st,v 1.17 1994-10-29 14:41:03 claus Exp $
 "
 !
 
@@ -658,6 +658,21 @@
 %}
 !
 
+lastScavangeReclamation
+    "returns the number of bytes replacimed by the last scavenge.
+     For statistic only - this may vanish."
+
+%{  /* NOCONTEXT */
+    extern int __newSpaceReclaimed();
+
+    RETURN ( _MKSMALLINT(__newSpaceReclaimed()) );
+%}
+    "
+     ((ObjectMemory lastScavangeReclamation)
+      / (ObjectMemory newSpaceSize)) * 100.0
+    "
+!
+
 runsSingleOldSpace
     "return true, if the system runs in a single oldSpace or
      false, if it has given up baker-collection. The memory
@@ -899,7 +914,7 @@
      This method should only be used in very special situations:
      for example, when building up some long-living data structure
      in a time critical application.
-     To do so, you have to do a scavenge before, and a tenure when the
+     To do so, you have to do a scavenge followed by a tenure after the
      objects are created. Be careful, to not reference any other chunk-
      data when calling for a tenure (this will lead to lots of garbage in
      the oldspace).
@@ -911,6 +926,12 @@
     "
      ObjectMemory tenure
     "
+    "
+     ... build up long living objects ...
+     ObjectMemory scavenge.
+     ObjectMemory tenure
+     ... continue - objects created above are now in oldSpace ...
+    "
 !
 
 garbageCollect
@@ -945,7 +966,6 @@
     "
 !
 
-
 markAndSweep
     "mark/sweep garbage collector.
      perform a full mark&sweep collect.
@@ -989,6 +1009,36 @@
     "
      ObjectMemory incrementalGC
     "
+!
+
+verboseGarbageCollect
+    "perform a compessing garbage collect and show some informational
+     output on the Transcript"
+
+    |nBytesBefore nReclaimed|
+
+    nBytesBefore := self oldSpaceUsed.
+    self garbageCollect.
+    nReclaimed := nBytesBefore - self oldSpaceUsed.
+    nReclaimed > 0 ifTrue:[
+	Transcript show:'reclaimed '.
+	nReclaimed > 1024 ifTrue:[
+	    nReclaimed > (1024 * 1024) ifTrue:[
+		Transcript show:(nReclaimed // (1024 * 1024)) printString.
+		Transcript showCr:' Mb.'
+	    ] ifFalse:[
+		Transcript show:(nReclaimed // 1024) printString.
+		Transcript showCr:' Kb.'
+	    ]
+	] ifFalse:[
+	    Transcript show:nReclaimed printString.
+	    Transcript showCr:' bytes.'
+	]
+    ]
+
+    "
+     ObjectMemory verboseGarbageCollect
+    "
 ! !
 
 !ObjectMemory class methodsFor:'garbage collector control'!
@@ -1166,6 +1216,17 @@
     }
 %}.
     ^ true
+!
+
+tenureParameters:magic
+    "this is pure magic and not for public eyes ...
+     This method exists to be able to fine tune internals,
+     in cooperation to some statistic & test programs.
+     It is undocumented, secret and may vanish."
+
+%{  /* NOCONTEXT */
+    __tenureParams(magic);
+%}.
 ! !
 
 !ObjectMemory class methodsFor:'physical memory access'!