discuss-gnustep
[Top][All Lists]
Advanced

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

Re: GNUstep and valgrind


From: Wolfgang Lux
Subject: Re: GNUstep and valgrind
Date: Tue, 20 Mar 2018 10:38:35 +0100

> Am 20.03.2018 um 07:31 schrieb amon <address@hidden>:

> I did try coding
> p=[NSAutoreleasePool new]; do something; [p release];
> and in some cases it seemed to help. In others it did not.
> I'll be digging deeper tomorrow and I will give the macros
> you suggested a try.

Just one word of warning. If you use this code (or the equivalent 
CREATE_AUTORELEASE_POOL macro), be sure to catch any exception that is raised 
in the "do something" code and make sure that the pool gets released, i.e., use
  p = [NSAutoreleasePool new];
  @try {
    do something;
  }
  @finally {
    [p release];
  }
Otherwise, you'll leak a whole autorelease pool on every exception raised in 
the do something part.

Wolfgang




reply via email to

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