Very strange GC behaviour

(Kroeger Simon (ext)) #1

[...]
One gotcha I've only seen after sending the other mail is, that moving
the variables to the outer loop won't buy you anything. While the GC
is disabled, this should eat infinite amounts of memory

GC.disable
a = "empty-"
loop do a += "" end
GC.enable

True, but

路路路

--------------------
GC.disable
a = "empty-"
loop do a << '' end
GC.enable
--------------------

should not :slight_smile:
and

--------------------
GC.disable
a = "empty-"
b = ''
loop do a << b end
GC.enable
--------------------

does not.

One has to be very carefull when disabling GC.
(Don't know if anything of this helps...)

cheers

Simon

(Brian Schr枚der) #2

That was exactly what I wanted to show ;-/

regards,

Brian

路路路

On 24/08/05, Kroeger Simon (ext) <simon.kroeger.ext@siemens.com> wrote:

> [...]
> One gotcha I've only seen after sending the other mail is, that moving
> the variables to the outer loop won't buy you anything. While the GC
> is disabled, this should eat infinite amounts of memory
>
> GC.disable
> a = "empty-"
> loop do a += "" end
> GC.enable

True, but

--------------------
GC.disable
a = "empty-"
loop do a << '' end
GC.enable
--------------------

should not :slight_smile:
and

--------------------
GC.disable
a = "empty-"
b = ''
loop do a << b end
GC.enable
--------------------

does not.

One has to be very carefull when disabling GC.
(Don't know if anything of this helps...)

cheers

Simon

--
http://ruby.brian-schroeder.de/

Stringed instrument chords: http://chordlist.brian-schroeder.de/