class TestProf::MemoryProf::Tracker::LinkedListNode
def add_nested(node)
def add_nested(node) @nested_memory += node.total_memory end
def finish(memory_at_finish)
def finish(memory_at_finish) @memory_at_finish = memory_at_finish previous&.add_nested(self) end
def hooks_memory
def hooks_memory total_memory - nested_memory end
def initialize(id:, item:, memory_at_start:, previous:)
def initialize(id:, item:, memory_at_start:, previous:) @id = id @item = item @previous = previous @memory_at_start = memory_at_start || 0 @memory_at_finish = nil @nested_memory = 0 end
def total_memory
def total_memory return 0 if memory_at_finish.nil? # It seems that on Windows Minitest may release a lot of memory to # the OS when it finishes and executes #report, leading to memory_at_finish # being less than memory_at_start. In this case we return nested_memory # which does not account for the memory used in `after` hooks, but it # is better than nothing. return nested_memory if memory_at_start > memory_at_finish memory_at_finish - memory_at_start end