Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-07-03 08:34:06


Tanguy Fautre <tanguy.fautre_at_[hidden]> writes:

> I've been assessing and learning boost.python (1.33.1). But when I add
> memory leak detection to a small test program (cf. attachment), I
> found tons of memory leaks (about 20 leaks).
>
> Even when the core of the program is only:
>
> try {
> Py_Initialize();
> object main_module = object(
> handle<>(borrowed(PyImport_AddModule("__main__"))) );
> }
>
> catch (const error_already_set &)
> {
> PyErr_Print();
> }
>
> Py_Finalize();
>
>
> it is still finding some memory leaks.
>
> Am I doing something wrong? Or is this a bug in boost.python?

Py_Finalize isn't supported by Boost.Python, as
http://www.boost.org/libs/python/todo.html#pyfinalize-safety explains.
That should also explain the "leaks" you are seeing.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk