Sha256: 14c217bfceb64579560aeb14bd817f8b618d56c176ee10ce652193e10fd42626
Contents?: true
Size: 779 Bytes
Versions: 3
Compression:
Stored size: 779 Bytes
Contents
module MemoryProfiler module Helpers def self.guess_gem(path) if /(\/gems\/.*)*\/gems\/(?<gem>[^\/]+)/ =~ path gem elsif /\/rubygems\// =~ path "rubygems" elsif /(?<app>[^\/]+\/(bin|app|lib))/ =~ path app else "other" end end # helper to work around GC.start not freeing everything def self.full_gc # attempt to work around lazy sweep, need a cleaner way GC.start while new_count = decreased_count(new_count) end def self.decreased_count(old) count = count_objects if !old || count < old count else nil end end def self.count_objects i = 0 ObjectSpace.each_object do |obj| i += 1 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
memory_profiler-0.0.3 | lib/memory_profiler/helpers.rb |
memory_profiler-0.0.2 | lib/memory_profiler/helpers.rb |
memory_profiler-0.0.1 | lib/memory_profiler/helpers.rb |