[C++-sig] Memory leaks in make_function.hpp?

David Abrahams david.abrahams at rcn.com
Tue Jun 18 12:52:38 CEST 2002


Not easily. The problem is that the class needs to be registered with the
class_registry in the BPL library. Since the class owns a reference to its
methods, that keeps the whole package alive indefinitely. I could use some
kind of weak reference to manage this, but that would only seem to make
things much more complicated.

    Dave

----- Original Message -----
From: "Dominic Sacré" <bugcreator at gmx.de>
To: <c++-sig at python.org>
Sent: Tuesday, June 18, 2002 5:29 AM
Subject: [C++-sig] Memory leaks in make_function.hpp?


Hi,

I tried to detect memory leaks in my own code by overriding operators new
and delete, and keeping track of all allocations.
It turned out there are also some leaks in Boost.Python. If I'm not
mistaken, the objects allocated by make_function() and make_constructor()
(called indirectly by class_<>.def() and class_<>.def_init()) are never
deleted. I guess that's not a big problem, as these objects will usually
only be destroyed when the program exits anyway, but would it be possible
to fix this?

    Dominic




_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig






More information about the Cplusplus-sig mailing list