On 8 October 2012 21:44, Ludovic Courtès <l...@gnu.org> wrote: >> On 8 October 2012 04:38, Ludovic Courtès <l...@gnu.org> wrote: >> Right. But then the pointer is being collected even though it remains >> inside the guardian, in the example it is never extracted from there. > > Well, when the object reaches the guardian’s zombie list, that’s because > it’s been finalized, so any weak references from that object can also be > nullified.
Ah. So I thought that being in the zombie list prevented any finalization, thus when the guardian returns an object it is still fully functional and only after the reference is lost again does it really get finalized. I will have to reread the doc for make-guardian where it talks about the weak links, perhaps with a healthy amount of source-code inspection ;-) Admittedly the test case here is quite contrived, and I agreed with your next remark in the original (pre-bug-report) thread. > Anyway, guardians are not a mechanism to protect objects from being > GC’d. To prevent the bytevector from being GC’d, you should either keep > the pointer object or the bytevector itself in non-GC’d memory, such as > a global variable or hash table. Yes. The intended use was obviously troubled, but it still seemed odd about the guardian's lack of protection. > How does it help? Should we close the bug? :-) Sure. At least you seem convinced and you has actually hacked on it :-) Regards