On Dec 18, 2012, at 16:26 , jahanian <[email protected]> wrote:

> 
> On Dec 18, 2012, at 4:10 PM, Jordan Rose <[email protected]> wrote:
> 
>> 
>>> if (!SFC) {
>>>   SFC = new SimpleFormatContext(Context.getLangOpts());
>>>   TU->FormatContext = SFC;
>>> -  }
>>> -  else if ((TU->FormatInMemoryUniqueId % 10) == 0) {
>>> +  } else if ((TU->FormatInMemoryUniqueId % 10) == 0) {
>>> +    // Delete after some number of iterators, so the buffers don't grow
>>> +    // too large.
>>>   delete SFC;
>>>   SFC = new SimpleFormatContext(Context.getLangOpts());
>> 
>> Hate to drag this out, but why not use an OwningPtr here? A little safer 
>> against future refactoring that misses a delete.
> 
> I a not sure I can use OwningPtr here. I am managing allocation and deletion 
> of the object
> after a number of usages  myself. This does;t fit the usage for OwningPtr as 
> I understand it.

Ah, I see…you're stealing the TU's format context, so it's not supposed to be 
freed at the end of the function. My mistake.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to