[MacRuby] #1323: memory leak occurs when use a exception which was inherited by Exception.
MacRuby
ruby-noreply at macosforge.org
Sun Jun 12 11:40:47 PDT 2011
#1323: memory leak occurs when use a exception which was inherited by Exception.
----------------------------------+-----------------------------------------
Reporter: watson1978@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone:
Component: MacRuby | Keywords:
----------------------------------+-----------------------------------------
Test Script:
{{{
#!ruby
def memory
pid = $$
str = `ps alx | grep '#{pid}.*ruby'`
str.split[7]
end
Thread.start {
sec = 0
loop do
puts "#{sec} sec : " + memory + " KB"
sleep 10
sec += 10
end
}
#=====================
class Custom_Exception < Exception
end
def foo
begin
bar
rescue Custom_Exception
end
end
def bar
begin
baz
rescue
#rescue Custom_Exception
# does not catch the Custom_Exception
puts "non Custom_Exception"
end
end
def baz
raise Custom_Exception
end
loop do
foo
end
}}}
Result:
{{{
$ macruby raise.rb
0 sec : 13744 KB
10 sec : 494708 KB
20 sec : 971928 KB
30 sec : 1420644 KB
40 sec : 1896572 KB
}}}
This problem seems to occur if does not catch the inherited Exception at
first begin-rescue.
--
Ticket URL: <http://www.macruby.org/trac/ticket/1323>
MacRuby <http://macruby.org/>
More information about the macruby-tickets
mailing list