Re: Losing my memory - a caching problem?
Re: Losing my memory - a caching problem?
- Subject: Re: Losing my memory - a caching problem?
- From: Cem Karan <email@hidden>
- Date: Tue, 17 Aug 2010 16:36:28 -0400
On Aug 17, 2010, at 4:05 PM, Stuart Rogers wrote:
> On 17 Aug 2010, at 18:07, Ken Ferry wrote:
>> On Tue, Aug 17, 2010 at 9:53 AM, Cem Karan <email@hidden> wrote:
>>
>>> One dumb question; I see where you're putting images into an autorelease pool, but I don't see you setting up or tearing down pools. Where are you doing that?
>>
>> Or, it could be much easier than I was saying and you might just need an autorelease pool.
>
> Good question, but I had that covered - here's my main loop code
> (with error handling snipped):
>
> for (NSString *path in self.paths)
> {
> // SNIP: User-initiated break-out check
>
> NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
> ImageSignature *sig = [self.net.factory signatureForPath:path];
> if (sig)
> {
> self.step = self.step + 1;
> [self.net feedforward:sig];
> [self processResponseForPath:path];
> }
> [pool release];
> }
>
> This all runs in the background via dispatch_async().
Have you tried using drain instead of release? That seems to be the preferred way at this point, triggering GC collection if needed (I don't know if your code is GC enabled, but if the library code is GC enabled, then this will solve some of those problems)
http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html#//apple_ref/occ/instm/NSAutoreleasePool/drain
Thanks,
Cem Karan_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden