Re: Image Batch Processing
Re: Image Batch Processing
- Subject: Re: Image Batch Processing
- From: "Jere Gmail" <email@hidden>
- Date: Fri, 21 Sep 2007 18:01:53 +0200
thanks. it worked great just adding this to the loop
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
...loop code
[loopPool release];
On 9/21/07, Simone Tellini <email@hidden> wrote:
> Jere Gmail ha scritto:
> > HI, I've been trying to do a batch converter for images. The problem
> > is the memory is not being released properly. When the for ends the
> > memory is ok, but during the for it continues increasing. I have a
> > function with a for loop:
> > for(count=0;count<cant;count++)
> > {
> > path=[datos objectAtIndex:count];
> > save_name=[NSString stringWithFormat:
> > @"image_d.jpg",count+1];
> >
>
> while the for() is running you're creating several instances of
> autoreleased objects like the NSString in the line above. These objects
> are not released until the control returns to the run loop.
>
> So if you don't want to keep on allocating memory during the loop, you
> can create an NSAutoreleasePool at the start and release it at the end.
> See
> http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/AutoreleasePools.html#//apple_ref/doc/uid/20000047
>
> --
> Simone Tellini
> http://tellini.info
>
>
--
http://zon7blog.blogspot.com/
And again we fall.
_______________________________________________
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