[C++-sig] Boost.Python Memory Leaks?

Lawrence Spector Lawrence.Spector at CanfieldSci.com
Thu Jun 28 19:51:41 CEST 2007


If this is true, that's a little upsetting to hear.  Boost is supposed
to be one of the best and most complete libraries ever written.   I
haven't seen this awful practice elsewhere from within boost.  Not
releasing dynamically allocated memory is a bad programming practice and
is not guaranteed to be freed on all platforms (although is on most).
Furthermore, any destructors never get called.  The Boost.Python group
needs to address this issue, because IMHO this is a serious bug/design
flaw.

 

It also mucks with our tests, because we're working on making a set of
automated tests and memory leaks are considered a type of failure.  Why
should poor programming practice inside Boost.Python be an exception?

 

-Lawrence

 

From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On
Behalf Of Ralf W. Grosse-Kunstleve
Sent: Wednesday, June 27, 2007 11:39 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] Boost.Python Memory Leaks?

 

This has come up many times before: Boost.Python doesn't support
PyFinalize(). There is no way to cleanup the global type conversion
registry. It wasn't on the agenda of the people funding Boost.Python
version 2 development (i.e. embedding wasn't on the list of things
considered important).
The leaks are harmless. Just don't use PyFinalize() and ignore the
memory occupied by the few globals Boost.Python instantiates.
My way of finding "real" leaks is very simple: wrap your code in an
endless loop and monitor the process with the top command (Linux or
OSX). Let it run for a couple of hours and check again. I've done this
many times (to check my own new C++ code). There are no "real" leaks in
Python or Boost.Python.
Ralf

 

________________________________

Need a vacation? Get great deals to amazing places
<http://us.rd.yahoo.com/evt=48256/*http:/travel.yahoo.com/;_ylc=X3oDMTFh
N2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ--> on
Yahoo! Travel. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070628/b92c8d90/attachment.htm>


More information about the Cplusplus-sig mailing list