Garbage collector - please Help !!

etienne at alias.it etienne at alias.it
Thu Jan 18 11:31:07 EST 2001


hi everybody,

I'm developping on a Macintosh platform a python based project with a C++
GUI.

The GUI is the application, calls to python are ambedded in the C++ code
with a proper GUI API interface.

I'm running into problems with
Python memory management.The set of python functions I run, is embedded
into a C GUI on the Macintosh. Since the interpreter does *NOT
DEALLOCATES* memory when I release PyObjects used either by the gui and
the interpreter, I was
supposing that it was my fault in increffing and decreffing objects.
I've deeply investigated into the object reference counts,
guessing I was coding wrong somewhere.Now I'm sure the C GUI increffs and
(most important) decreffs PyObjects properly.
The result is that the Python Interpreter sucks all the application
memory causing the application to crash (exit).
*BUT* I performed the following tests:
1 -  I've run my python code from the python ide (notice: same code
without the C embedding api).Result: It sucks all the memory allocated by
the python ide, causing it to except a Memory error;
2- I've run my python code on a Linux OS.Result: It worked perfectly,
deallocating memory as espected.

This convinced me that it is due to the Python garbage collector, is
this correct?

Is there a way to force the PythonCore garbage collector to deallocate
memory when
objects are disposed??
There's a path you can suggest for further investigation??
I'm using PythonCore 1.5.2, Is there any resonable chance that Python
2.0 will do a better job?

thanks in advance
etienne


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list