class HeapInfo::Tcache

Fetch tcache structure and show its content.

Constants

MAX_BINS

define TCACHE_MAX_BINS 64

Public Class Methods

new(base, size_t, dumper) click to toggle source

Instantiate a {HeapInfo::Tcache} object.

@param [Integer] base Base address of tcache. @param [Integer] size_t Either 8 or 4. @param [Proc] dumper For dumping more data.

# File lib/heapinfo/tcache.rb, line 13
def initialize(base, size_t, dumper)
  @base = base
  @size_t = size_t
  @dumper = dumper
end

Public Instance Methods

layouts() click to toggle source

Pretty dump of tcache entries.

@return [String] Tcache entries that wrapper with color codes.

# File lib/heapinfo/tcache.rb, line 22
def layouts
  entries.map(&:inspect).join
end

Private Instance Methods

entries() click to toggle source
# File lib/heapinfo/tcache.rb, line 28
def entries
  Array.new(MAX_BINS) do |idx|
    TcacheEntry.new(@size_t, @base + 64 + @size_t * idx, @dumper, head: true).tap { |f| f.index = idx }
  end
end