178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/heapy/alive.rb', line 178
def self.traced_objects(retained_by: false)
raise "You aren't tracing anything call Heapy::Alive.trace_without_retain first" if @retain_hash.empty?
self.gc_start
ObjectSpace.dump_all(output: File.open(@heap_file,'w'))
retainer_address_array_hash = {}
Analyzer.new(@heap_file).read do |json_hash|
address = json_hash["address"]
tracer = @retain_hash[address]
next unless tracer
tracer.raw_json_hash = json_hash
if retained_by
retainers_from_json_hash(json_hash, target_address: address, retainer_array: tracer.retained_by)
end
end
@retain_hash.values
end
|