Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[bug] serious memory leak + continuations
Michael Neumann
12/21/2004 1:34:00 PM
Hi,
ruby 1.9.0 (2004-12-20) [i386-freebsd5.2.1]
gcc version 3.3.3 [FreeBSD] 20031106
In my application, if I change:
# (1) this works
callback_stream.with_callbacks_for(self, :action) { |callback, val|
catch(:something) { callback.call }
throw :wee_back_to_session
}
into:
# (2) this leaks
callback_stream.with_callbacks_for(self, :action) { |callback, val|
res = catch(:something) { callback.call }
throw :wee_back_to_session
}
or into:
# (3) this leaks
callback_stream.with_callbacks_for(self, :action) { |callback, val|
callback.call
throw :wee_back_to_session
}
memory consumption is unbounded! BTW, ":something" is never thrown. It
seems that if I reference the return value of callback.call, the memory
leak appears. The leak also happens if I change "res = " in (2) into
"@res = " or "$res = ". Note that inside callback.call continuations are
created.
And if I return "nil" from the block (callback.call), it leaks, too,
even if I use code sample (1).
I tried above example also with ruby-stable compiled with 2.95.4 (-O0
enabled), but there all three examples leak memory.
It seems to be related to the "unknown node type 0 bug", as it appears
to be pretty random (at least in my eyes):
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
Help! I can send the whole sources to someone who is interested. Only
requirements are rubygems, installed narf gem (webunit) and gnuplot to
display memory consumption, and of course *nix.
Regards,
Michael
1 Answer
Michael Neumann
12/21/2004 5:45:00 PM
0
Michael Neumann wrote:
> Hi,
>
> ruby 1.9.0 (2004-12-20) [i386-freebsd5.2.1]
> gcc version 3.3.3 [FreeBSD] 20031106
>
> In my application, if I change:
>
> # (1) this works
> callback_stream.with_callbacks_for(self, :action) { |callback, val|
> catch(:something) { callback.call }
> throw :wee_back_to_session
> }
>
> into:
>
> # (2) this leaks
> callback_stream.with_callbacks_for(self, :action) { |callback, val|
> res = catch(:something) { callback.call }
> throw :wee_back_to_session
> }
>
> or into:
>
> # (3) this leaks
> callback_stream.with_callbacks_for(self, :action) { |callback, val|
> callback.call
> throw :wee_back_to_session
> }
>
> memory consumption is unbounded! BTW, ":something" is never thrown. It
> seems that if I reference the return value of callback.call, the memory
> leak appears. The leak also happens if I change "res = " in (2) into
> "@res = " or "$res = ". Note that inside callback.call continuations are
> created.
>
> And if I return "nil" from the block (callback.call), it leaks, too,
> even if I use code sample (1).
>
> I tried above example also with ruby-stable compiled with 2.95.4 (-O0
> enabled), but there all three examples leak memory.
>
> It seems to be related to the "unknown node type 0 bug", as it appears
> to be pretty random (at least in my eyes):
>
>
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>
>
> Help! I can send the whole sources to someone who is interested. Only
> requirements are rubygems, installed narf gem (webunit) and gnuplot to
> display memory consumption, and of course *nix.
The memory leak probably results from the fact that the continuations
are not garbage collected. The number of them keep growing in (2) and
(3), whereas in (1) it stays constant.
Regards,
Michael
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[bug] serious memory leak + continuations
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password