From: Martin Duerst Date: 2007-12-24T13:39:27+09:00 Subject: Re: IRHG - GC Memory Fragmentation? At 17:39 07/12/23, Charles Thornton wrote: >While working on Chapter 05 and referencing various works >on Garbage Collection, I keep seeing that Mark & Sweep are >considered to have a problem with memory fragmentation. > >Since I have not seen any complaints on this subject on the core >list, I am wondering if there is something inherent about Ruby >that prevents major fragmentation. > >For example, since all basic ruby objects are the same size, does >this help reduce fragmentation of the GC space? Yes, on the ruby heaps, all objects are represented by 20 bytes, so there is no fragmentation there at all. Fragmentation occurs on the general heap, where all the rest of the data is (e.g. the actual string data for a string, the actual array of VALUEs for an array, and so on). The data on the general heap is allocated with a malloc/calloc/realloc/free from the underlyinng OS/C library, so the fragmentation occurring there isn't a GC problem, and not even a Ruby problem in the strict sense. Regards, Martin. #-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University #-#-# http://www.sw.it.aoyama.ac.jp mailto:duerst@it.aoyama.ac.jp