class Appsignal::GarbageCollectionProfiler

@api private
leak memory by keeping garbage collection run samples in memory.
constantly clearing ‘GC::Profiler`’s total_time to make sure it doesn’t
able to track garbage collection time for multiple transactions, while
{Appsignal::GarbageCollectionProfiler} wraps Ruby’s ‘GC::Profiler` to be

def self.lock

def self.lock
  @lock ||= Mutex.new
end

def initialize

def initialize
  @total_time = 0
end

def internal_profiler

def internal_profiler
  GC::Profiler
end

def lock

def lock
  self.class.lock
end

def total_time

Returns:
  • (Integer) -
def total_time
  lock.synchronize do
    @total_time += (internal_profiler.total_time * 1000).round
    internal_profiler.clear
  end
  @total_time = 0 if @total_time > 2_000_000_000
  @total_time
end