This function provides statistics on the current state of the storage, including the amount of space currently allocated, and the amount available for allocation.
As outlined in the Common Lisp Hyperspec, the room
function takes an optional argument which controls the level of detail it produces.
Given an argument of nil
, a summary of the total allocation in the entire heap (in kilobytes) is produced. The "allocated" figure only represents the amount of space allocated in heap segments that are writable, as opposed to read-only segments that hold some of the system code such as the garbage collector itself. The free space figure covers all the free space in all segments.
When called without an argument, room
additionally prints information on the distribution of space between the generations of the heap.
When called with argument t
, a breakdown of allocation in the individual segments of each generation is produced. Each segment is identified by its start address in memory. For each segment there is a free space threshold (the "minimum free space")--when the available space in the segment falls below this value, the garbage collector takes action to attempt to free more space in this segment.
Two statistics about promotion are also reported on a per-segment basis: the number of sweeps that an object must survive in this generation before becoming eligible for promotion, and the total volume of objects that have survived for that long and are consequently awaiting promotion to the next generation. These statistics are not relevant for static segments, which are indicated as "static".
USER 109 > (room nil)
Total Size 10043K, Allocated 4898K, Free 2009K
USER 110 > (room)
Generation 0: Total Size 1314K, Allocated 35K, Free 1271K
Generation 1: Total Size 1284K, Allocated 731K, Free 508K
Generation 2: Total Size 4376K, Allocated 4131K, Free 230K
Total Size 10043K, Allocated 4898K, Free 2009K
USER 111 > (room t)
Generation 0: Total Size 1314K, Allocated 35K, Free 1271K
Segment 7203872: Total Size 256K, Allocated 35K, Free 216K
minimum free space 64K,
Awaiting promotion = 0K, sweeps before promotion =10
Segment 9200432: Total Size 1058K, Allocated 0K, Free 1054K
minimum free space 0K,
Awaiting promotion = 0K, sweeps before promotion =10
Generation 1: Total Size 1284K, Allocated 731K, Free 508K
Segment 8151856: Total Size 1024K, Allocated 577K, Free 425K
minimum free space 0K,
Awaiting promotion = 0K, sweeps before promotion =10
Segment 5631008: Total Size 132K, Allocated 109K, Free 1K
minimum free space 3K,
Awaiting promotion = 0K, sweeps before promotion =10
Segment 5499936: Total Size 128K, Allocated 43K, Free 80K
minimum free space 0K, static
Generation 2: Total Size 4376K, Allocated 4131K, Free 230K
Segment 7466016: Total Size 669K, Allocated 595K, Free 70K
minimum free space 0K,
Awaiting promotion = 472K, sweeps before promotion =10
Segment 5767040: Total Size 1403K, Allocated 1316K, Free 82K
minimum free space 0K,
Awaiting promotion = 1174K, sweeps before promotion =10
Segment 3014656: Total Size 2304K, Allocated 2219K, Free 78K
minimum free space 0K,
Awaiting promotion = 2174K, sweeps before promotion =10
Total Size 10043K, Allocated 4898K, Free 2009K
USER 112 >