If I only call the constructors but no getter/setters, and I put a while(1){} at the end of Node.pl it doesn't happen, the script just "waits" (loops). So one thing that triggers it is global object destruction.
If I call set_parent($p), then an infinite loop, I notice that the destructor is triggered on the invocant $node (but not on $p). The malloc error doesn't happen. Note that the setter is not void: it returns the invocant. So there's a side effect to the conversion of the output in the typemap that makes a refcount drop to zero somewhere, triggering object destruction. However, a blessed reference to Node* is still returned.
If I call set_parent twice, the malloc error happens.
In reply to Re^6: Inline::C self-referential struct idioms and memory
by rutgeraldo
in thread Inline::C self-referential struct idioms and memory
by rutgeraldo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |