Python cleanup on exit

J

Jacob Kroon

Hi,

I'm working on a library written in C using GObject, which i
provide python bindings for using pygtk. When I checked the
library for memory leaks using valgrind, I noticed that none
of the objects I created in the script (that is they are global in
the script) were deleted on exit. After some googling I came
to the conslusion that the python interpreter doesn't "cleanup"
after itself on exit, because of shutdown performance.

This means that if I want to check the library for mem leaks I have
to either manually "del myobject1, delmyobject2 ..." at the end
of the scripts, or make sure that all objects get created in a
function scope, so that python will delete them for me when
the interpreter exits the scope.

Is there another way to make python delete objects which were
created in the global scope upon exit ?

Jacob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top