Skip to content

Commit

Permalink
Improve memleak example
Browse files Browse the repository at this point in the history
  • Loading branch information
dasch committed May 28, 2010
1 parent 9b782d9 commit ea4b003
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/leak.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

N = ARGV[0] ? Integer(ARGV[0]) : 100000

N.times { Minx.spawn { } }
N.times { Minx.spawn { Minx.channel.read } }

GC.start

count = ObjectSpace.each_object(Minx::Process) { }
processes = ObjectSpace.each_object(Minx::Process) { }
channels = ObjectSpace.each_object(Minx::Channel) { }

puts "Number of Process instances: #{count}"
puts "Number of Process instances: #{processes}"
puts "Number of Channel instances: #{channels}"

0 comments on commit ea4b003

Please sign in to comment.