Sha256: d98fc8a2999dec0485b6c716455c746229f331e97bca22549a1494a8892c87a0

Contents?: true

Size: 375 Bytes

Versions: 20

Compression:

Stored size: 375 Bytes

Contents

# frozen_string_literal: true
class DeferredGarbageCollection
  DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 15.0).to_f

  @last_gc_run = Time.zone.now

  def self.start
    GC.disable
  end

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

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
onotole-2.0.2 templates/deferred_garbage_collection.rb
onotole-2.0.1 templates/deferred_garbage_collection.rb
onotole-2.0.0 templates/deferred_garbage_collection.rb
onotole-1.2.11 templates/deferred_garbage_collection.rb
onotole-1.2.10 templates/deferred_garbage_collection.rb
onotole-1.2.9 templates/deferred_garbage_collection.rb
onotole-1.2.8 templates/deferred_garbage_collection.rb
onotole-1.2.7 templates/deferred_garbage_collection.rb
onotole-1.2.6 templates/deferred_garbage_collection.rb
onotole-1.2.5 templates/deferred_garbage_collection.rb
onotole-1.2.4 templates/deferred_garbage_collection.rb
onotole-1.2.3 templates/deferred_garbage_collection.rb
onotole-1.2.2 templates/deferred_garbage_collection.rb
onotole-1.2.1 templates/deferred_garbage_collection.rb
onotole-1.1.21 templates/deferred_garbage_collection.rb
onotole-1.1.20 templates/deferred_garbage_collection.rb
onotole-1.1.19 templates/deferred_garbage_collection.rb
onotole-1.1.18 templates/deferred_garbage_collection.rb
onotole-1.1.17 templates/deferred_garbage_collection.rb
onotole-1.1.16 templates/deferred_garbage_collection.rb