try monitoring used memory an GC by that
This commit is contained in:
parent
21667768aa
commit
fc941fa88b
1 changed files with 6 additions and 1 deletions
|
|
@ -11,7 +11,12 @@ class DeferredGarbageCollection
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.reconsider
|
def self.reconsider
|
||||||
if DEFERRED_GC_THRESHOLD > 0 && Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD
|
mem = %x(free).split(" ")
|
||||||
|
percent_used = mem[8].to_i / (mem[7].to_i/100)
|
||||||
|
|
||||||
|
puts "percent memory used #{percent_used}" # just for info, as soon as we got some numbers remove it
|
||||||
|
|
||||||
|
if( (DEFERRED_GC_THRESHOLD > 0 && Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD) || percent_used > 90 )
|
||||||
GC.enable
|
GC.enable
|
||||||
GC.start
|
GC.start
|
||||||
GC.disable
|
GC.disable
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue