in reply to Re^2: perl embedded in C++: how to undefine perl objects that are blessed references to C++ objects when the C++ object destructs
in thread perl embedded in C++: how to undefine perl objects that are blessed references to C++ objects when the C++ object destructs
I'm far from expert on Perl internals, but given the way Perl allocates it variables I think that this would necessitate scanning the entire stack and entire heap attempting to find values in memory locations that 'look like' the SV* in question. Besides being rather slow, it is fraught with dangers.
What would you search for? How would you distinguish between four bytes that contain the address of your C++ object, and four bytes that contain a number that coincidentally matches the address of your C++ object?
And what benefit would you get? If the Perl code is going to indirect through a retained SV* and so trap; if you set it to undef, it is still going to indirect through it and die anyway. It might be a less violent death, but there is still no way for the Perl code to reasonably continue.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: perl embedded in C++: how to undefine perl objects that are blessed references to C++ objects when the C++ object destructs
by kingkongrevenge (Scribe) on Sep 21, 2009 at 20:19 UTC | |
by BrowserUk (Patriarch) on Sep 21, 2009 at 22:39 UTC | |
by kingkongrevenge (Scribe) on Sep 21, 2009 at 23:58 UTC |