Sha256: c6df16348a06cb9c0833c3e51d3d490a8d427be712fa789ec8cbc68afb916d67

Contents?: true

Size: 334 Bytes

Versions: 60

Compression:

Stored size: 334 Bytes

Contents

class DeferredGarbageCollection

  DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f

  @@last_gc_run = Time.now

  def self.start
    GC.disable
  end

  def self.reconsider
    if Time.now - @@last_gc_run >= DEFERRED_GC_THRESHOLD
      GC.enable
      GC.start
      GC.disable
      @@last_gc_run = Time.now
    end
  end
end

Version data entries

60 entries across 60 versions & 9 rubygems

Version Path
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/support/deferred_garbage_collection.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.17.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.16.pre spec/support/deferred_garbage_collection.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/support/deferred_garbage_collection.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/support/deferred_garbage_collection.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.15.pre spec/support/deferred_garbage_collection.rb
activeadmin-1.0.0.pre5 spec/support/deferred_garbage_collection.rb
activeadmin-orac-1.0.0.pre4 spec/support/deferred_garbage_collection.rb
activeadmin-orac-1.0.0 spec/support/deferred_garbage_collection.rb
activeadmin-orac-1.0.0.pre.orac spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.14.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.13.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.12.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.11.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.10.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.9.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.8.pre spec/support/deferred_garbage_collection.rb
activeadmin_polymorphic-0.3.6 spec/support/deferred_garbage_collection.rb