Module: EnvMem
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
Instance Method Details
#dump_to_file(filename) ⇒ Object
6 7 8 |
# File 'lib/env_mem.rb', line 6 def dump_to_file(filename) File.open(filename, "w") { |f| f.write GC.stat.inspect } end |
#gc_stat_to_shell(stats) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/env_mem.rb', line 10 def gc_stat_to_shell(stats) stats_hash = {} stats.scan(/:([a-zA-Z_]+)\s*=>\s*([0-9]+)/).each { |key, val| stats_hash[key] = val.to_i } "# gc_params.heap_init_slots\nexport RUBY_GC_HEAP_INIT_SLOTS=\#{stats_hash[\"heap_live_slots\"]}\n\n# gc_params.malloc_limit_min\nexport RUBY_GC_MALLOC_LIMIT=\n\n# gc_params.oldmalloc_limit_min\nexport RUBY_GC_OLDMALLOC_LIMIT=\n\n" end |