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
yousty-activeadmin-1.0.6.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.5.pre spec/support/deferred_garbage_collection.rb
activeadmin_polymorphic-0.1.0 spec/support/deferred_garbage_collection.rb
activeadmin-0.6.6 spec/support/deferred_garbage_collection.rb
activeadmin-0.6.5 spec/support/deferred_garbage_collection.rb
activeadmin-0.6.4 spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.4.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.3.pre spec/support/deferred_garbage_collection.rb
active_administration-0.0.3 spec/support/deferred_garbage_collection.rb
activeadministration-0.0.2 spec/support/deferred_garbage_collection.rb
active_administration-0.0.2 spec/support/deferred_garbage_collection.rb
activeadministration-0.0.1 spec/support/deferred_garbage_collection.rb
active_administration-0.0.1 spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.2.pre spec/support/deferred_garbage_collection.rb
activeadmin-0.6.3 spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.1.pre spec/support/deferred_garbage_collection.rb
yousty-activeadmin-1.0.0.pre spec/support/deferred_garbage_collection.rb
activeadmin-0.6.2 spec/support/deferred_garbage_collection.rb
activeadmin-0.6.1 spec/support/deferred_garbage_collection.rb
aa-rails4-0.6.0 spec/support/deferred_garbage_collection.rb