in reply to Re^5: Inline::C self-referential struct idioms and memory
in thread Inline::C self-referential struct idioms and memory
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Inline::C self-referential struct idioms and memory
by BrowserUk (Patriarch) on Sep 04, 2015 at 20:45 UTC | |
by rutgeraldo (Novice) on Sep 04, 2015 at 21:28 UTC | |
by syphilis (Archbishop) on Sep 05, 2015 at 01:30 UTC | |
by BrowserUk (Patriarch) on Sep 04, 2015 at 21:34 UTC |