Class: Heapy::Alive::ObjectTracker
- Inherits:
-
Object
- Object
- Heapy::Alive::ObjectTracker
- Defined in:
- lib/heapy/alive.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#raw_json_hash ⇒ Object
Returns the value of attribute raw_json_hash.
-
#tracked_to_s ⇒ Object
readonly
Returns the value of attribute tracked_to_s.
Instance Method Summary collapse
- #id2ref ⇒ Object
-
#initialize(object_id: nil, address: nil, to_s:) ⇒ ObjectTracker
constructor
A new instance of ObjectTracker.
- #object_retained? ⇒ Boolean
- #retained_by ⇒ Object
- #retainer_array ⇒ Object
- #root? ⇒ Boolean
Constructor Details
#initialize(object_id: nil, address: nil, to_s:) ⇒ ObjectTracker
Returns a new instance of ObjectTracker.
232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/heapy/alive.rb', line 232 def initialize(object_id: nil, address: nil, to_s: ) if object_id @address = "0x#{ (object_id << 1).to_s(16) }" else @address = address end raise "must provide address: #{@address.inspect}" if @address.nil? @tracked_to_s = to_s.dup @retained_by = nil end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
230 231 232 |
# File 'lib/heapy/alive.rb', line 230 def address @address end |
#raw_json_hash ⇒ Object
Returns the value of attribute raw_json_hash.
266 267 268 |
# File 'lib/heapy/alive.rb', line 266 def raw_json_hash @raw_json_hash end |
#tracked_to_s ⇒ Object (readonly)
Returns the value of attribute tracked_to_s.
230 231 232 |
# File 'lib/heapy/alive.rb', line 230 def tracked_to_s @tracked_to_s end |
Instance Method Details
#id2ref ⇒ Object
245 246 247 |
# File 'lib/heapy/alive.rb', line 245 def id2ref Heapy::Alive.address_to_object(address) end |
#object_retained? ⇒ Boolean
253 254 255 |
# File 'lib/heapy/alive.rb', line 253 def object_retained? raw_json_hash && raw_json_hash["address"] end |
#retained_by ⇒ Object
262 263 264 |
# File 'lib/heapy/alive.rb', line 262 def retained_by @retained_by || Heapy::Alive.retained_by(tracer: self) end |
#retainer_array ⇒ Object
257 258 259 260 |
# File 'lib/heapy/alive.rb', line 257 def retainer_array @retained_by ||= [] @retained_by end |
#root? ⇒ Boolean
249 250 251 |
# File 'lib/heapy/alive.rb', line 249 def root? false end |