<body><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Could it be that LargePositiveIntegers are created on-the-fly when accessing a Bitmap via #basicAt: (or the mirror primitive)?<div><br></div><div>Best,</div><div>Marcel</div><div class="mb_sig"></div><blockquote class='history_container' type='cite' style='border-left-style:solid;border-width:1px; margin-top:20px; margin-left:0px;padding-left:10px;'>
                        <p style='color: #AAAAAA; margin-top: 10px;'>Am 17.12.2020 17:39:11 schrieb Marcel Taeumel <marcel.taeumel@hpi.de>:</p><div style='font-family:Arial,Helvetica,sans-serif'><div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000;text-align: left" dir="ltr">
                                        Hmmm... this one generates LargePositiveIntegers while counting ... it never finishes:<div><br></div><div><span style="font-size: 13.3333px">Space</span>Tally new spaceForInstancesOf: Bitmap depth: 1. </div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Any ideas? =) The use of IdentitySet for depth > 0 might require some blacklisting ...</span></div><div><span style="font-size: 13.3333px"><br></span></div><div><span style="font-size: 13.3333px">Best,</span></div><div><span style="font-size: 13.3333px">Marcel</span></div><div class="mb_sig"></div>
                                        <blockquote class="history_container" type="cite" style="border-left-style: solid;border-width: 1px;margin-top: 20px;margin-left: 0px;padding-left: 10px;min-width: 500px">
                        <p style="color: #AAAAAA; margin-top: 10px;">Am 17.12.2020 17:04:33 schrieb commits@source.squeak.org <commits@source.squeak.org>:</p><div style="font-family:Arial,Helvetica,sans-serif">Marcel Taeumel uploaded a new version of System to project The Trunk:<br>http://source.squeak.org/trunk/System-mt.1198.mcz<br><br>==================== Summary ====================<br><br>Name: System-mt.1198<br>Author: mt<br>Time: 17 December 2020, 5:04:11.447084 pm<br>UUID: 0e532d14-69bc-3e4f-9e1b-67f880aa3001<br>Ancestors: System-pre.1197, System-mt.1175<br><br>Refines System-mt.1175, which adds a way to compute a space tally for objects up to a certain depth. Updates class comment to provide more examples. (See http://forum.world.st/The-Inbox-System-mt-1175-mcz-tp5122678.html)<br><br>=============== Diff against System-pre.1197 ===============<br><br>Item was changed:<br>  Object subclass: #SpaceTally<br>+      instanceVariableNames: 'results depth'<br>-       instanceVariableNames: 'results'<br>      classVariableNames: ''<br>        poolDictionaries: ''<br>          category: 'System-Tools'!<br>  <br>+ !SpaceTally commentStamp: '<historical>' prior: 0!<br>+ I'm responsible to help getting information about system space usage. The information I compute is represented by a spaceTallyItem.<br>- !SpaceTally commentStamp: 'sd 6/20/2003 22:31' prior: 0!<br>- I'm responsible to help getting information about system space usage. The information I compute is represented by a spaceTallyItem<br>  <br>+ Here are some examples to inspect:<br>+         SpaceTally new spaceTally: (Array with: TextMorph with: Point).<br>+      SpaceTally new systemWideSpaceTally.<br>+         SpaceTally new depth: 2; spaceTally: (PackageInfo named: #Morphic) classes.<br>+  SpaceTally new depth: 1; spaceTally: (PackageInfo named: #Monticello) classes. "Includes cached source code"<br>+       SpaceTally new spaceForInstancesOf: Form depth: 2. "Includes bitmaps and large integers"!<br>- try something like: <br>- <br>- ((SpaceTally new spaceTally: (Array with: TextMorph with: Point)) <br>-        asSortedCollection: [:a :b | a spaceForInstances > b spaceForInstances]) <br>- <br>- SpaceTally new systemWideSpaceTally<br>- <br>- <br>- This class has been created from a part of SystemDictionary. It still deserves a nice<br>- clean, such as using object instead of array having 4 slots.<br>- <br>- sd-20 June 2003!<br><br>Item was changed:<br>  ----- Method: SpaceTally>>computeSpaceUsage (in category 'class analysis') -----<br>  computeSpaceUsage<br>  <br>+     | seenObjects |<br>+      seenObjects := self depth > 0 ifTrue: [IdentitySet new].<br>   results<br>               do: [ :entry |<br>                        | class instanceSpaceAndCount |<br>                       class := self class environment at: entry analyzedClassName.<br>                          Smalltalk garbageCollectMost.<br>+                        instanceSpaceAndCount := self spaceForInstancesOf: class depth: self depth seen: seenObjects.<br>-                        instanceSpaceAndCount := self spaceForInstancesOf: class.<br>                     entry <br>                                codeSize: class spaceUsed;<br>                            instanceCount: instanceSpaceAndCount second;<br>+                                 spaceForInstances: instanceSpaceAndCount first;<br>+                              depthOfSpace: self depth ]<br>-                           spaceForInstances: instanceSpaceAndCount first ]<br>              displayingProgress: 'Taking statistics...'!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>depth (in category 'accessing') -----<br>+ depth<br>+ <br>+         ^ depth ifNil: [0]!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>depth: (in category 'accessing') -----<br>+ depth: anInteger<br>+ <br>+     depth := anInteger.!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>spaceForInstance: (in category 'instance size') -----<br>+ spaceForInstance: anObject<br>+ <br>+   ^ self spaceForInstance: anObject depth: self depth!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>spaceForInstance:depth: (in category 'instance size') -----<br>+ spaceForInstance: anObject depth: anInteger<br>+ <br>+    ^ self spaceForInstance: anObject depth: anInteger seen: (anInteger > 0 ifTrue: [IdentitySet new])!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>spaceForInstance:depth:seen: (in category 'instance size') -----<br>+ spaceForInstance: anObject depth: anInteger seen: seenObjectsOrNil<br>+ <br>+      | ctxt class basicSize depth total |<br>+         seenObjectsOrNil ifNotNil: [<br>+                 (seenObjectsOrNil ifAbsentAdd: anObject) ifFalse: [^ 0]].<br>+    ctxt := thisContext.<br>+         class := ctxt objectClass: anObject.<br>+         basicSize := 0.<br>+      total := class isVariable<br>+            ifTrue: [class byteSizeOfInstanceOfSize: (basicSize := ctxt objectSize: anObject)]<br>+           ifFalse: [class isImmediateClass ifTrue: [0] ifFalse: [class byteSizeOfInstance]].<br>+   (depth := anInteger - 1) >= 0 ifTrue: [<br>+           anObject isCompiledCode<br>+                      ifTrue: [<br>+                            anObject literalsDo: [:literal |<br>+                                     total := total + (self spaceForInstance: literal depth: depth seen: seenObjectsOrNil)]]<br>+                      ifFalse: [<br>+                           1 to: basicSize do: [:index |<br>+                                        total := total + (self spaceForInstance: (ctxt object: anObject basicAt: index) depth: depth seen: seenObjectsOrNil)].<br>+                               1 to: class instSize do: [:index |<br>+                                   total := total + (self spaceForInstance: (ctxt object: anObject instVarAt: index) depth: depth seen: seenObjectsOrNil)]]].<br>+   ^ total!<br><br>Item was changed:<br>  ----- Method: SpaceTally>>spaceForInstancesOf: (in category 'instance size') -----<br>  spaceForInstancesOf: aClass<br>-     "Answer a pair of the number of bytes consumed by all instances of the<br>-   given class, including their object headers, and the number of instances."<br>  <br>+         ^ self spaceForInstancesOf: aClass depth: self depth!<br>-        | instances total |<br>-  instances := aClass allInstances.<br>-    instances isEmpty ifTrue: [^#(0 0)].<br>-         total := 0.<br>-  aClass isVariable<br>-            ifTrue:<br>-                      [instances do:<br>-                               [:i| total := total + (aClass byteSizeOfInstanceOfSize: i basicSize)]]<br>-               ifFalse:<br>-                     [total := instances size * aClass byteSizeOfInstance].<br>-       ^{ total. instances size }!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>spaceForInstancesOf:depth: (in category 'instance size') -----<br>+ spaceForInstancesOf: aClass depth: anInteger<br>+ <br>+         ^ self spaceForInstancesOf: aClass depth: anInteger seen: (anInteger > 0 ifTrue: [IdentitySet new])!<br><br>Item was added:<br>+ ----- Method: SpaceTally>>spaceForInstancesOf:depth:seen: (in category 'instance size') -----<br>+ spaceForInstancesOf: aClass depth: anInteger seen: seenObjects<br>+  "Answer a pair of the number of bytes consumed by all instances of the given class, including their object headers, and the number of instances. Follow each instance's fields up to the given depth. Beware of cycles to shared objects, which will tamper the resulting numbers.<br>+ <br>+  SpaceTally new spaceForInstancesOf: Form depth: 0. --- Same as #spaceForInstancesOf:<br>+         SpaceTally new spaceForInstancesOf: Form depth: 1. --- Includes memory footprint for bits etc.<br>+       SpaceTally new spaceForInstancesOf: Form depth: 2. --- Also includes LargePositiveIntegers in bitmaps ;-)<br>+    "<br>+ <br>+   | instances total |<br>+  instances := aClass allInstances.<br>+    instances isEmpty ifTrue: [^#(0 0)].<br>+         total := 0.<br>+  instances do: [:each | total := total + (self spaceForInstance: each depth: anInteger seen: seenObjects)].      <br>+     ^{ total. instances size }!<br><br>Item was changed:<br>  Object subclass: #SpaceTallyItem<br>+         instanceVariableNames: 'analyzedClassName codeSize instanceCount spaceForInstances depthOfSpace'<br>-     instanceVariableNames: 'analyzedClassName codeSize instanceCount spaceForInstances'<br>   classVariableNames: ''<br>        poolDictionaries: ''<br>          category: 'System-Tools'!<br>  <br>  !SpaceTallyItem commentStamp: 'sd 6/20/2003 22:02' prior: 0!<br>  I'm represent an entry in the spaceTally.!<br><br>Item was added:<br>+ ----- Method: SpaceTallyItem>>depthOfSpace (in category 'accessing') -----<br>+ depthOfSpace<br>+ <br>+       ^ depthOfSpace!<br><br>Item was added:<br>+ ----- Method: SpaceTallyItem>>depthOfSpace: (in category 'accessing') -----<br>+ depthOfSpace: aNumber<br>+ <br>+         depthOfSpace := aNumber!<br><br>Item was changed:<br>  ----- Method: SpaceTallyItem>>printOn: (in category 'printing') -----<br>  printOn: aStream<br>  <br>          analyzedClassName<br>             ifNotNil: [ aStream nextPutAll: analyzedClassName asString]. <br>         aStream nextPutAll: ' ('.<br>     codeSize<br>              ifNotNil: [ aStream nextPutAll: 'code size: ' ;  nextPutAll: codeSize asString]. <br>     instanceCount<br>                 ifNotNil: [ aStream nextPutAll: ' instance count: ' ;  nextPutAll: instanceCount asString]. <br>          spaceForInstances<br>             ifNotNil: [ aStream nextPutAll: ' space for instances: ' ;  nextPutAll: spaceForInstances asBytesDescription]. <br>+      depthOfSpace<br>+                 ifNotNil: [ aStream nextPutAll: ' depth of space: ' ; nextPutAll: depthOfSpace asString].<br>     aStream nextPut: $).<br>          !<br><br><br></historical></div></blockquote></div></div></blockquote>
                                        </div></body>