Class: DeferredGarbageCollection
- Inherits:
-
Object
- Object
- DeferredGarbageCollection
- Defined in:
- lib/kowl/templates/tests/rspec/support/deferred_garbage_collection.rb,
lib/kowl/templates/tests/minitest/support/deferred_garbage_collection.rb
Overview
Constant Summary collapse
- DEFERRED_GC_THRESHOLD =
(ENV['DEFER_GC'] || 10.0).to_f
- @@last_gc_run =
Time.now
Class Method Summary collapse
Class Method Details
.reconsider ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/kowl/templates/tests/rspec/support/deferred_garbage_collection.rb', line 13 def self.reconsider return unless DEFERRED_GC_THRESHOLD.positive? && Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD GC.enable GC.start GC.disable @@last_gc_run = Time.now end |
.start ⇒ Object
9 10 11 |
# File 'lib/kowl/templates/tests/rspec/support/deferred_garbage_collection.rb', line 9 def self.start GC.disable if DEFERRED_GC_THRESHOLD.positive? end |