[C++-sig] memory leak with __iadd__

Neal Becker ndbecker2 at gmail.com
Thu Sep 26 16:44:08 CEST 2013


Nikolay Mladenov wrote:

> On Wed, Sep 25, 2013 at 11:22 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
> 
>> I've been trying to track down a memory leak.  When I use the following:
>>
>>  .def ("__iadd__", &hist_t::operator+=, bp::return_self<>())
>>
> 
> but this is no different then any other function def with return_self<>
> policy (which i do a lot)?
> when do you observe the leak? during def or during a+b in python?
> 
> 

The leak must be in using +=.  The def is only executed once.  This is a big 
leak, causing eventual OOM.



More information about the Cplusplus-sig mailing list