FROM : Paul Bailey
DATE : Tue Apr 29 13:44:28 2008
Of course, if that's the case, simply wrapping the whole section of code
with its own autorelease pool will cause the memory to be released at the
end of each iteration.
Paul
On Tue, Apr 29, 2008 at 12:37 PM, Graham Cox <graham.<email_removed>> wrote:
> It sounds like something in "some code" is also retaining tempSource
> (probably autoreleasing it), so that the release at the end of the loop is
> not actually releasing, but the subsequent release of the autorelease pool
> at the end of the event is doing so.
>
> So without "some code" it's hard to say what that could be.
>
>
> G.
>
>
>
>
> On 29 Apr 2008, at 9:30 pm, Yannick De Koninck wrote:
>
> > Hi everybody,
> >
> > I am writing an application where, at some point in time, the user
> > clicks a button and for a great amount of images the average pixel values
> > are calculated and stored in an array.
> > Basically this looks like this:
> >
> > -(IBAction)Generate:(id)sender
> > {
> >
> > // some code
> >
> > for (i = 0; i < count; i++)
> > {
> > NSImage* tempSource = [[NSImage alloc]
> > initWithContentsOfFile:sPath[i]];
> > // some code
> > [tempSource release];
> > }
> >
> > }
> >
> >
> > When debugging with ObjectAlloc i found that the memory release does not
> > happen when the release message is sent but only after the Generate function
> > is done. So instead of allocating, deallocating, allocating, deallocating...
> > the application keeps allocating memory and only releases it afterwards.
> > This becomes a big problem when the amount of loaded pictures rises. Is
> > there a way to force the memory manager to free the memory when the release
> > message is sent instead of after the call? Or can i solve this problem in
> > another way?
> > Thank you very much,
> > Yannick, Belgium
> > _______________________________________________
> >
> > Cocoa-dev mailing list (<email_removed>)
> >
> > 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:
> >
> > http://lists.apple.com/mailman/options/cocoa-dev/graham.<email_removed>
> >
> > This email sent to graham.<email_removed>
> >
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Tue Apr 29 13:44:28 2008
Of course, if that's the case, simply wrapping the whole section of code
with its own autorelease pool will cause the memory to be released at the
end of each iteration.
Paul
On Tue, Apr 29, 2008 at 12:37 PM, Graham Cox <graham.<email_removed>> wrote:
> It sounds like something in "some code" is also retaining tempSource
> (probably autoreleasing it), so that the release at the end of the loop is
> not actually releasing, but the subsequent release of the autorelease pool
> at the end of the event is doing so.
>
> So without "some code" it's hard to say what that could be.
>
>
> G.
>
>
>
>
> On 29 Apr 2008, at 9:30 pm, Yannick De Koninck wrote:
>
> > Hi everybody,
> >
> > I am writing an application where, at some point in time, the user
> > clicks a button and for a great amount of images the average pixel values
> > are calculated and stored in an array.
> > Basically this looks like this:
> >
> > -(IBAction)Generate:(id)sender
> > {
> >
> > // some code
> >
> > for (i = 0; i < count; i++)
> > {
> > NSImage* tempSource = [[NSImage alloc]
> > initWithContentsOfFile:sPath[i]];
> > // some code
> > [tempSource release];
> > }
> >
> > }
> >
> >
> > When debugging with ObjectAlloc i found that the memory release does not
> > happen when the release message is sent but only after the Generate function
> > is done. So instead of allocating, deallocating, allocating, deallocating...
> > the application keeps allocating memory and only releases it afterwards.
> > This becomes a big problem when the amount of loaded pictures rises. Is
> > there a way to force the memory manager to free the memory when the release
> > message is sent instead of after the call? Or can i solve this problem in
> > another way?
> > Thank you very much,
> > Yannick, Belgium
> > _______________________________________________
> >
> > Cocoa-dev mailing list (<email_removed>)
> >
> > 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:
> >
> > http://lists.apple.com/mailman/options/cocoa-dev/graham.<email_removed>
> >
> > This email sent to graham.<email_removed>
> >
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| Yannick De Koninck | Apr 29, 13:30 | |
| Graham Cox | Apr 29, 13:37 | |
| João Pavão | Apr 29, 13:44 | |
| Paul Bailey | Apr 29, 13:44 | |
| Joseph Kelly | Apr 29, 16:50 | |
| Bob Smith | Apr 29, 22:33 | |
| Yannick De Koninck | Apr 30, 14:09 | |
| Graham Cox | Apr 30, 14:18 | |
| Roland King | Apr 30, 15:08 | |
| Graham Cox | Apr 30, 15:17 | |
| matt.gough | Apr 30, 15:35 | |
| Graham Cox | May 1, 02:53 | |
| Jens Alfke | May 1, 04:27 | |
| Graham Cox | May 1, 04:45 | |
| Chris Suter | May 1, 04:59 | |
| Melissa J. Turner | May 1, 05:35 | |
| j o a r | May 1, 07:00 | |
| Paul Bailey | May 1, 11:05 | |
| Clark Cox | May 1, 16:16 | |
| Ken Thomases | May 1, 18:31 |






Cocoa mail archive

