[C++-sig] memory leak with __iadd__

Nikolay Mladenov nikolay.mladenov at gmail.com
Wed Sep 25 19:02:03 CEST 2013


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?



>
> I have a leak.
>
> When changed to:
>
>  .def (bp::self += hist_t::value_type())
>
> there is no leak.  Any ideas?  I suppose I maybe should just start using
> the
> latter style and forget the former.
>
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> https://mail.python.org/mailman/listinfo/cplusplus-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20130925/2e8dd3df/attachment.html>


More information about the Cplusplus-sig mailing list