Sha256: d7bdf2d533f2c5bb9ede78cb1e6b963400d6755ec1022e5f892268e80ace585d
Contents?: true
Size: 821 Bytes
Versions: 22
Compression:
Stored size: 821 Bytes
Contents
# -*- encoding : utf-8 -*- require 'map' ## # gc = lambda do 10.times{ GC.start } end leak = lambda do 100.times do m = Map.new 1000.times do |i| m[rand.to_s] = rand end end gc.call() end ## # leak.call() before = Process.size leak.call() after = Process.size delta = [after.first - before.first, after.last - before.last] p :before => before p :after => after p :delta => delta ## # BEGIN { module Process def self.size pid = Process.pid stdout = `ps wwwux -p #{ pid }`.split(%r/\n/) vsize, rsize = stdout.last.split(%r/\s+/)[4,2].map{|i| i.to_i} end def self.vsize size.first.to_i end def self.rsize size.last.to_i end end }
Version data entries
22 entries across 22 versions & 2 rubygems
Version | Path |
---|---|
map-5.3.0 | test/leak.rb |
map-5.2.0 | test/leak.rb |