Class: Workarea::DeferredGarbageCollection
- Inherits:
-
Object
- Object
- Workarea::DeferredGarbageCollection
- Defined in:
- lib/workarea/testing/deferred_garbage_collection.rb
Constant Summary collapse
- DEFERRED_GC_THRESHOLD =
(ENV['DEFER_GC'] || 3.0).to_f
- @@last_gc_run =
Time.current
Class Method Summary collapse
Class Method Details
.reconsider ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/workarea/testing/deferred_garbage_collection.rb', line 11 def self.reconsider if DEFERRED_GC_THRESHOLD > 0 && Time.current - @@last_gc_run >= DEFERRED_GC_THRESHOLD GC.enable GC.start GC.disable @@last_gc_run = Time.current end end |
.start ⇒ Object
7 8 9 |
# File 'lib/workarea/testing/deferred_garbage_collection.rb', line 7 def self.start GC.disable if DEFERRED_GC_THRESHOLD > 0 end |