On Feb 16, 4:12=A0am, Piotr Sawicki <piotr.sawi... / gmail.com> wrote:
> Run this program and observe memory usage.
>
> <code>
>
> def leaker
> =A0 =A0 a =3D ""
> =A0 =A0 10000.times do
> =A0 =A0 =A0 =A0 =A0a =3D a + "buble"
> =A0 =A0 end
> =A0 =A0 a =3D ""
> end
>
> loop do
> =A0 =A0 leaker
> end
>
> </code>
> --
> Posted viahttp://www.ruby-forum.com/.

Not a bug in any way. It's simply that the garbage collector has not
been trigger. It runs only when it needs to. As you realized you, you
can force it to run by doing 'GC.start'. If you run 'GC.start' at the
end of your program, you'll see the memory reclaimed.

This is a typical behavior for a mark/sweep garbage collector. Perl
and Python are reference count, freeing memory the instant it goes out
of scope. Ruby waits to free memory until it needs memory to free some.