[pypy-dev] cppyy: C++ bindings for PyPy

Alex Pyattaev alex.pyattaev at gmail.com
Mon Apr 23 11:26:54 CEST 2012


Well, I have never been able to isolate it, and the project where it is 
triggered is rather close-sourced. 

long story short - make up a SWIG object inside a function, pass it as a 
pointer to the swig-wrapped function, then call gc.collect(). After that swig 
calls object's destructor and if the C code is using it, youre screwd.

I am not sure if the bug persists on a small scale, however, it only shows 
during long simulation runs where thousands of objects like that are 
circulated.
If it ever happens on a smaller case I'll let you know.
Alex
maanantai 23 huhtikuu 2012 10:52:04 Amaury Forgeot d'Arc kirjoitti:

2012/4/23 Alexander Pyattaev <alexander.pyattaev at tut.fi>

Right now the main problem with SWIG is the object ownership, i.e. with pypy 
one has to set thisown=False for all objects to avoid crashes related to GC 
code. The problem occurs only for long-living objects though.

Do you have a sample code for this issue?


-- 
Amaury Forgeot d'Arc



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120423/01ea544a/attachment.html>


More information about the pypy-dev mailing list