V
Victor \Zverok\ Shepelev
Hi all.
Here's a problem.
I have some object of MyClass with complex "freeing" logic, and I want to
test this logic.
I do:
---------
span = .... #somehow created object
ObjectSpace.define_finalizer(span, proc{p "gc ok"}) #define test finalizer
span.detach #remove object from all of my internal caches, no references
to object should exist
span = nil #remove the last reference to object
GC.start #<===HERE the object must be collected and finalized
p "end of code"
---------
I expect:
---
"gc ok"
"end of code"
---
I receive:
---
"end of code"
"gc ok"
---
OK, I suppose there are some references to the object still exists. I want
to know, at least, what number of references still exists (in ideal, I'd
want to know, where they are).
How I can? (except of harcode hacking GC's C code)
Ruby 1.9 (downloaded a week ago), Windows.
Thanks.
V.
Here's a problem.
I have some object of MyClass with complex "freeing" logic, and I want to
test this logic.
I do:
---------
span = .... #somehow created object
ObjectSpace.define_finalizer(span, proc{p "gc ok"}) #define test finalizer
span.detach #remove object from all of my internal caches, no references
to object should exist
span = nil #remove the last reference to object
GC.start #<===HERE the object must be collected and finalized
p "end of code"
---------
I expect:
---
"gc ok"
"end of code"
---
I receive:
---
"end of code"
"gc ok"
---
OK, I suppose there are some references to the object still exists. I want
to know, at least, what number of references still exists (in ideal, I'd
want to know, where they are).
How I can? (except of harcode hacking GC's C code)
Ruby 1.9 (downloaded a week ago), Windows.
Thanks.
V.