module Memtf

A simple utility to help isolate memory leaks. Two memory snapshots are compared to determine which classes, if any, are leaking.

Constants

START

Represents the starting memory snapshot

STOP

Represents the ending memory snapshot

VERSION

Attributes

runner[RW]

Public Class Methods

around(options={}, &block) click to toggle source

Generate an initial memory snapshot, execute the block, then generate the final memory snapshot.

@param [Hash] options

# File lib/memtf.rb, line 35
def around(options={}, &block)
  start(options)
  block.call if block_given?
  stop(options)
end
start(options={}) click to toggle source

Generate an initial memory snapshot.

@param [Hash] options @return [Runner]

# File lib/memtf.rb, line 17
def start(options={})
  self.runner = Runner.run(START, options)
end
stop(options={}) click to toggle source

Generate a final memory snapshot.

@param [Hash] options

# File lib/memtf.rb, line 24
def stop(options={})
  default_group = self.runner.group
  Runner.run(STOP, {:group => default_group}.merge(options))
ensure
  self.runner = nil
end