[C++-sig] Memory Leaks In VS.NET 2003 With BOOST_PYTHON_MODULE

Matthew B. Keyes Keyes at simcrest.com
Mon Oct 10 21:32:04 CEST 2005


Ralf,

Thanks tons again for the help!  Needless to say, that will save me from
pulling my hair out over this :)

Thanks again,
Matt

"Ralf W. Grosse-Kunstleve" <rwgk at yahoo.com> wrote in message
news:<20051010190642.45158.qmail at web31502.mail.mud.yahoo.com>...
> --- mjkeyes at sbcglobal.net wrote:
> 
> > Ralf (et. al),
> > 
> > (note - I hope my newsgroup reader doesn't wrap all this in one
line)
> > 
> > I've been playing around with this and I'm still thinking boost
leaks
> > memory in an embedded and extended application.  I use Visual Leak
> > Detector 1.0 to track memory leaks, and here is where the leak comes
> > from (in my code):
> > ...
> > If I insert VLDDisable() before this class_ block and VLDEnable()
after
> > (which temporarily disables the leak detection for this function
call),
> > I get zero leaks.  With it turned on, here is what I see (repeated
17
> > times):
> > ...
> >
d:\devl\muds\testbed\completelibtest\thirdlibtest\lib\pythoninputhandler
> > .h (153): init_module_PyInputHandler
> >     0x10006C2B (File and line number not available):
> > boost::python::detail::exception_handler::operator=
> >     0x1000EC23 (File and line number not available):
> > boost::python::detail::init_module
> >     0x1E0682B1 (File and line number not available):
PyImport_FindModule
> >     0x48747570 (File and line number not available): (Function name
> > unavailable)
> >   Data:
> > 	... (whatever data leaked)
> 
> I believe these leaks are not actually leaks, but a documented
> (http://www.boost.org/libs/python/todo.html) feature of Boost.Python,
directly
> connected to the lack of support for PyFinalize(). I think what you
are seeing
> as leaks are actually just entries in the global converter registry.
These are
> one-time static allocations. Since you cannot dlopen the same module
multiple
> times there is no danger that these allocations become a real problem.
> See also: boost/libs/python/src/converter/registry.cpp
> 
> Why is PyFinalize() support missing? -- Simply because the groups who
invested
> money into Boost.Python development had no interest in embedding.
> 
> To find real leaks, please consider my very simple approach of calling
the code
> with the suspected problem in an infinite loop while monitoring the
memory
> allocation of the process. Simple, quick, very effective, works the
same on all
> platforms. I've done it many times, coincidentally a couple of days
ago while
> testing new low-level code. I didn't see any real leaks.
> 
> Cheers,
>         Ralf
> 
> 
> 
> 		
> __________________________________ 
> Yahoo! Music Unlimited 
> Access over 1 million songs. Try it free.
> http://music.yahoo.com/unlimited/



More information about the Cplusplus-sig mailing list