gnustep-dev
[Top][All Lists]
Advanced

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

Re: Memory Leak in NSString.m


From: Richard Frith-Macdonald
Subject: Re: Memory Leak in NSString.m
Date: Wed, 21 Feb 2001 23:23:54 +0000

On Wednesday, February 21, 2001, at 08:25 PM, Thorano wrote:

>  
> There is a very minor memory leak in the function parsePlItem. If 
> there's an error in the parsing of a Dictionary or an Array, the 
> function returns nil but does not release the container it has just 
> allocated.  
>  
> In this function and the one it depends on, the created object are not 
> autoreleased. And I think it would simplify the code if they are. In 
> the present code, we must release by hand every created object in the 
> case of an error and that's the origine of the current memory leak 
>  
> I included a patch that fix the memory leak by using the autorelease 
> mechanism. I also modify GSPropertyList as a consequence of this 
> patch.  

I've added releases to fix the memory leak (I think).
Using autorelease may simplify the code a little ... but it would make it
a whole lot slower.  I know this because I originally implemented it
using autorelease and had to rewrite to use release in order to get
decent performance with large property-lists.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]