Tuesday, October 4, 2011

Some GC stats

I invested some time making MIT/GNU Scheme compile itself with various sizes of heap. I did one set of runs with the variable compiler:preserve-data-structures? set to #f and another with it set to #t. The MIT/GNU Scheme compiler was written in a way that allows the garbage collector to reap the intermediate storage for the compiler after each phase of compilation. When compiler:preserve-data-structures? is set to #t, however, the intermediate data structures are retained until the next compilation. This should not change the total amount of storage used by the compiler, but it should have the effect of reducing the amount of storage recovered by a GC cycle. The number of GC cycles can be seen to be larger for the smaller heap sizes. When the heap is huge, the extra amount of storage in use has little effect on the GC count.

The Total Free column contains the sum of the memory freed after each GC totaled for the entire compilation.
Memory SizeDiscard Data StructuresPreserve Data Structures
(blocks)(words)GC CountTotal FreeGC CountTotal Free
1890 193536039356213003931 - -
1900 194560038826211940217 - -
1920 196608038186213153480 - -
2048 209715235026210260535 - -
3072 314572821786205257571 - -
4096 41943041589620769766816266200942665
5000 51200001283620608132513036198903924
6144 62914561033621067590410436205324016
8192 8388608 7666212253195 7716207156928
16384 16777216 3776222514645 3796233468540
32768 33554432 1886257358354 1886244416384
40000 40960000 1546266232939 1546257300338
50000 51200000 1246316240152 1246311996423
65536 67108864 946283277196 946276744843
98304100663296 636324424897 636320187112
131072134217728 486430202774 486426705701
262144268435456 256704242312 256702940561
Some of my thoughts about this (with graphs) in a bit. (It becomes very interesting when the data seriously disagrees with the math, but it is tedious to collect enough data to either support or refute the mathematical model.)

No comments: