From: Juanjo V. <jv...@cn...> - 2010-11-18 16:02:14
|
Hello everybody! I'm trying to fix a problem with swig since a lot of time ago. I'm wrapping a C++ library to use it from java. This library is pretty complex, so we don't want to reimplement algorithms in java. But, the problem is that objects are destroyed while execution and I don't now why. I can create them from java, but if I call any of the C++ functions it crashes because of NULL pointers. I tried to do some research and I discovered that objects destructor is invoked somewhere ¡¡but there is no explicit call to it!! =S. And it doesn't happen in all computers, which is really weird. I found some stuff on the internet: http://stackoverflow.com/questions/2778332/hot-to-get-rid-of-memory-allocations-deallocations-in-swig-wrappers But it shows some complex stuff that I don't understand. I also think this problem might have something to do with what they call "premature garbage collection": http://www.swig.org/Doc1.3/Java.html#java_pgcpp But, ¿how do I set "swigCMemOwn" in the swig interface, to not allow auto garbage collection? I would appreciate any help with that as it's driving me mad =/ and I can't continue with my development until this is fixed =( Sincerelly, Juanjo Vega. -- Juanjo Vega (jv...@cn...) Unidad de Biocomputación. Laboratorio B-13. Centro Nacional de Biotecnología. CNB-CSIC. C\ Darwin, 3. Campus de Cantoblanco. Universidad Autónoma de Madrid. 28049, Madrid, Spain. +34 91 585 4510 http://www.cnb.csic.es http://www.biocomp.cnb.csic.es "Las mejores almas son capaces de los mayores vicios como de las mayores virtudes, y aquellos que caminan despacio por el camino recto pueden llegar más lejos que los que corren pero se apartan de él." - Discurso del Método, René Descartes. |