discuss-gnustep
[Top][All Lists]
Advanced

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

Re: GNUstep and valgrind


From: Richard Frith-Macdonald
Subject: Re: GNUstep and valgrind
Date: Fri, 16 Mar 2018 15:32:26 +0000


> On 16 Mar 2018, at 15:18, amon <address@hidden> wrote:
> 
> 
>            [arglist release];
>  arglist = [[[NSMutableString stringWithCString: [cmdline cString]]
>               componentsSeparatedByString: DELIM] retain];
> 
> This happens inside an init. arglist is release by the dealloc
> method. However, NSMutableString insists on making it autoreleased.
> I want to make it not do that. 

Portable GNUstep code would look like this:

CREATE_AUTORELEASE_POOL(pool);
ASSIGN(arglist, [[[NSMutableString stringWithCString: [cmdline cString]] 
componentsSeparatedByString: DELIM]);
DESTROY(pool);

with no wasted/leaked memory.




reply via email to

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