ObjectMemory.st
changeset 10 4f1f9a91e406
parent 5 67342904af11
child 13 62303f84ff5f
--- a/ObjectMemory.st	Mon Nov 08 03:29:58 1993 +0100
+++ b/ObjectMemory.st	Mon Nov 08 03:32:43 1993 +0100
@@ -19,7 +19,8 @@
                            RecursionInterruptHandler IOInterruptHandler
 
                            AllocationFailureSignal
-                           IncrementalGCLimit'
+                           IncrementalGCLimit
+                           Dependents'
        poolDictionaries:''
        category:'System-Support'
 !
@@ -29,7 +30,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
              All Rights Reserved
 
-$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.4 1993-10-13 02:12:56 claus Exp $
+$Header: /cvs/stx/stx/libbasic/ObjectMemory.st,v 1.5 1993-11-08 02:31:07 claus Exp $
 '!
 
 !ObjectMemory class methodsFor:'documentation'!
@@ -68,6 +69,8 @@
 IngrementalGCLimit              number of bytes, that must be allocated since
                                 last full garbage collect to turn on incremental
                                 collector.
+Dependents                      keep my dependents locally (its faster) for
+                                all those registries
 "
 ! !
 
@@ -87,6 +90,20 @@
     ^ AllocationFailureSignal
 ! !
 
+!ObjectMemory class methodsFor:'dependents access'!
+
+dependents
+    "return the colleciton of my dependents"
+
+    ^ Dependents
+!
+
+dependents:aCollection
+    "set the dependents collection"
+
+    Dependents := aCollection
+! !
+
 !ObjectMemory class methodsFor:'cache management'!
 
 flushInlineCachesForClass:aClass
@@ -196,6 +213,10 @@
     ^ TimerInterruptHandler
 !
 
+timerInterruptHandler:aHandler
+    TimerInterruptHandler := aHandler
+!
+
 spyInterruptHandler
     ^ SpyInterruptHandler
 !
@@ -259,7 +280,9 @@
 !ObjectMemory class methodsFor:'queries'!
 
 newSpaceUsed
-    "return the number of bytes allocated for new objects"
+    "return the number of bytes allocated for new objects.
+     The returned value is usually obsolete as soon as you do
+     something ..."
 
 %{  /* NOCONTEXT */
     RETURN ( _MKSMALLINT(__newSpaceUsed()) );
@@ -268,7 +291,8 @@
 !
 
 oldSpaceUsed
-    "return the number of bytes allocated for old objects"
+    "return the number of bytes allocated for old objects.
+     (This includes the free lists)"
 
 %{  /* NOCONTEXT */
     RETURN ( _MKSMALLINT(__oldSpaceUsed()) );
@@ -276,12 +300,22 @@
     "ObjectMemory oldSpaceUsed"
 !
 
+freeSpace
+    "return the number of bytes in the free lists.
+     (which is included in oldSpaceUsed)"
+
+%{  /* NOCONTEXT */
+    RETURN ( _MKSMALLINT(__freeSpace()) );
+%}
+    "ObjectMemory freeSpace"
+!
+
 bytesUsed
     "return the number of bytes allocated for objects -
      this number is not exact, since some objects may be dead"
 
 %{  /* NOCONTEXT */
-    RETURN ( _MKSMALLINT(__oldSpaceUsed() + __newSpaceUsed()) );
+    RETURN ( _MKSMALLINT(__oldSpaceUsed() + __newSpaceUsed() - __freeSpace()) );
 %}
     "ObjectMemory bytesUsed"
 !
@@ -484,7 +518,8 @@
     savedTranscript := Transcript.
     savedRoot := RootView.
 
-    "a kludge: save image with modified knownViews ..."
+    "a kludge: save image with modified knownViews, no idle- and timeoutblocks
+     and also Transcript set to StdErr ..."
 
     Display knownViews:nil.
     Display idleBlocks:nil.
@@ -492,13 +527,10 @@
     RootView := nil.
 
     Transcript := Stderr.
-    StartupClass := startupClass.
-    StartupSelector := startupSelector.
-
+    Smalltalk startupClass:startupClass selector:startupSelector arguments:nil.
     self snapShotOn:aFileName.
+    Smalltalk startupClass:nil selector:nil arguments:nil.
 
-    StartupClass := nil.
-    StartupSelector := nil.
     RootView := savedRoot.
     Transcript := savedTranscript.
     Display knownViews:viewsKnown.