Re: ustring memory leak



On Thu, 01 Apr 2010 19:47:24 +0200
michi7x7 <mailing-lists michi7x7 de> wrote:
> Chris Vine wrote:
> > Or if we are being entirely rigorous about it, just possibly when
> > you construct a std::string object your compiler is dispensing with
> > the copy constructor (which will be inline), as it is entitled but
> > not required to do, but does not do this when constructing a
> > Glib::ustring object (the constructor for which is not inline); and
> > the copy constructor of std::string, called by the copy constructor
> > of Glib::ustring, is leaking.
> >
> > This seems most unlikely but you could test for it by directly
> > initialising the string (which in my opinion is better style
> > anyway).
>  
> Usually Compiles invoke the Constructor, not the Copy-Constructor
> when using this style.
> 
> So
> Glib::ustring u = "Test";
> should be the same as
> Glib::ustring u("Test");
> 
> Try it, but it should not change anything.

You probably need to re-read my post.  Or at any rate, I don't think
much stands between elision of the copy constructor "just possibly" not
happening (my words) and "usually" happening (your words).  I would go
for either.

Chris


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]