Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python 2.7.3, C++ embed memory leak?

81 views
Skip to first unread message

Qi

unread,
May 29, 2012, 10:37:27 AM5/29/12
to
Hi guys,

Is there any known memory leak problems, when embed Python 2.7.3
in C++?
I Googled but only found some old posts.

I tried to only call Py_Initialize() and Py_Finalize(), nothing else
between those functions, Valgrind still reports memory leaks
on Ubuntu?

Is that a know problem? Did Python 3.x solve it?

I want some confirmation.


Thanks


--
WQ

Ulrich Eckhardt

unread,
May 29, 2012, 11:29:01 AM5/29/12
to
Am 29.05.2012 16:37, schrieb Qi:
> I tried to only call Py_Initialize() and Py_Finalize(), nothing else
> between those functions, Valgrind still reports memory leaks
> on Ubuntu?

Call the pair of functions twice, if the reported memory leak doesn't
increase, there is no problem. I personally wouldn't even call this a
leak then, but that depends a bit on the precise definition.

Uli

Qi

unread,
May 29, 2012, 10:08:51 PM5/29/12
to
On 2012-5-29 23:29, Ulrich Eckhardt wrote:
>
> Call the pair of functions twice, if the reported memory leak doesn't
> increase, there is no problem. I personally wouldn't even call this a
> leak then, but that depends a bit on the precise definition.

I should still call it a memory leak though it seems less harmful.
And it causes trouble that I have difficulty to distinguish if
the leaks are from Python or from my binding code, if I add binding
between that pair of functions.


--
WQ

Diez B. Roggisch

unread,
Jun 2, 2012, 6:53:24 AM6/2/12
to
Python does some special things that confuse valgrind. Don't bother.

http://svn.python.org/projects/python/trunk/Misc/README.valgrind

Diez

Qi

unread,
Jun 2, 2012, 8:37:34 AM6/2/12
to
On 2012-6-2 18:53, Diez B. Roggisch wrote:
> Python does some special things that confuse valgrind. Don't bother.
>
> http://svn.python.org/projects/python/trunk/Misc/README.valgrind

Thanks for the link.
It clears a lot of my confusing, such as uninitialized reading...


--
WQ
0 new messages