From: Eliot Miranda Date: 2008-02-21T11:15:00+09:00 Subject: Re: GC error ? Piotr Sawicki wrote: > Rados��aw Bu��at wrote: >> You refer to cycles inside method "leaker". But this method always >> creates the same amount of objects so I don't see reason why ruby eats >> more and more memory for each "leaker" call. > > Haw gc works ? Here is pseudocode: > > malloc_limit = 8_000_000 > malloc_increase = 0; > > malloc(size) > { > malloc_increase += size; > if (malloc_increase > malloc_limit) > garbage_collect() > } > > garbage_collect() > { > malloc_limit = malloc_limit + (malloc_increase - malloc_limit) * > some_factor > malloc_increase = 0 > } In my day they were called libraries. Now its called "wikipedia". http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29 But efore you read up, ask yourself how you *think* it might work. One hint. Its paradoxical. To first collect garbage you could identify everything you don't wan to throw away. HTH -- The surest sign that intelligent life exists elsewhere in Calvin & the universe is that none of it has tried to contact us. Hobbes. -- Eliot ,,,^..^,,, Smalltalk - scene not herd