ok but why? I assume if this works that the NSImage alloc/ initWithContentsOfFile: is doing a retain/autorelease.
Of course that wouldn't violate the letter of the memory management  
documentation, which really just tells you that if you alloc/init an  
object, you are responsible for freeing it, I thought the spirit of it  
sort of implied that nobody else had retained/released the object and  
it wasn't sitting on someone's autorelease pool and as soon as you  
released it, it was gone.





On Apr 30, 2008, at 8:18 PM, Graham Cox wrote:

-(IBAction) Generate:(id) sender
{
        for (i = 0; i < count; i++)
        {
            NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];

NSImage* tempSource = [[NSImage alloc] initWithContentsOfFile:sPath[i]];
                // some code
            [tempSource release];
        
            [pool release];
        }
}



hth, G.


On 30 Apr 2008, at 10:09 pm, Yannick De Koninck wrote:
I deleted everything that was between NSImage* tempSource = [[NSImage alloc] initWithContentsOfFile:sPath[i]; and [tempSource release]; so basically this is the code (sPath is a NSString array containing path names):
-(IBAction)Generate:(id)sender
{


for (i = 0; i < count; i++)
                {
NSImage* tempSource = [[NSImage alloc] initWithContentsOfFile:sPath[i]];
        [tempSource release];
}

}

And still the same problem occurs. So the problem is that the memory is not immediately released. You think this can be solved by using an autoreleasepool? I'm pretty new to cocoa programming and i never used autoreleasepools before.
Thank you very much, Yannick
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/rols%40rols.org

This email sent to [EMAIL PROTECTED]
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to