Embed presentation
Download to read offline




![Some tools
memprof, gdb, scrap
[68.63 MB] GET /stats/scrap
Number of objects : 815266 (627150 AST nodes, 76.93%)
Heap slot size : 20
GC cycles so far : 352
Number of heaps : 7
Total size of objects: 15923.16 KB
Total size of heaps : 18036.55 KB (2113.39 KB = 11.72%
unused)
Leading free slots : 18545 (362.21 KB = 2.01%)
Trailing free slots : 0 (0.00 KB = 0.00%)
Number of contiguous groups of 16 slots: 2685 (4.65%)
Number of terminal objects: 4697 (0.51%)](https://image.slidesharecdn.com/rubygc-101128193057-phpapp02/85/Ruby-Performance-Part-1-Garbage-Collection-5-320.jpg)


This document discusses strategies for optimizing Ruby garbage collection performance. By default, Ruby uses a mark and sweep garbage collector and allocates memory in exponentially increasing heap sizes. A better strategy is to stabilize on 1-2 constant heap sizes by setting a high minimum heap size and using linear heap size increments. Various tools like memprof and gdb can provide statistics on memory usage and garbage collection cycles to analyze performance.




![Some tools
memprof, gdb, scrap
[68.63 MB] GET /stats/scrap
Number of objects : 815266 (627150 AST nodes, 76.93%)
Heap slot size : 20
GC cycles so far : 352
Number of heaps : 7
Total size of objects: 15923.16 KB
Total size of heaps : 18036.55 KB (2113.39 KB = 11.72%
unused)
Leading free slots : 18545 (362.21 KB = 2.01%)
Trailing free slots : 0 (0.00 KB = 0.00%)
Number of contiguous groups of 16 slots: 2685 (4.65%)
Number of terminal objects: 4697 (0.51%)](https://image.slidesharecdn.com/rubygc-101128193057-phpapp02/85/Ruby-Performance-Part-1-Garbage-Collection-5-320.jpg)
