Richard Heck | 1 May 16:55 2011
Picon
Picon

Re: Memory LyXs

On 04/30/2011 09:14 PM, venom00 wrote:
>> I've looked briefly at this one before, and I find it confusing.  It
>> looks as if it is saying that we are leaking the docstring 
>> word itself,
>> i.e., that it's not being cleaned up, but why would that be?
> Mmmh, I find it pretty simple: we have some elements added to a set but never removed.
I know less about this then I should. (I'm just an amateur.) But: When
we call delete d, doesn't this call the d->words_ destructor? I mean,
you can do:

    if (...) {
        set<int> tmp;
        for (int i = 0; i < 1000; ++i)
            tmp.insert(i);
    }

and there is no memory leak, because all the ints in the set are
destroyed when tmp goes out of scope. Similarly, when we delete the
pimpl, the words_ set should be deleted, and this takes care of
everything in that set. Right?

>> The other thing maybe worth trying is something simple like:
>>
>> Index: src/Paragraph.cpp
>> ===================================================================
>> --- src/Paragraph.cpp (revision 38560)
>> +++ src/Paragraph.cpp (working copy)
>>  <at>  <at>  -3500,12 +3500,11  <at>  <at> 
>>     pos_type from = pos;
>>     locateWord(from, pos, WHOLE_WORD);
(Continue reading)


Gmane