Problems with setImage
Problems with setImage
- Subject: Problems with setImage
- From: Benedikt Iltisberger <email@hidden>
- Date: Sun, 06 Mar 2011 09:19:06 +0100
Hello everybody,
I have a problem with the setImage method because its leaking memory.
I think I understood memory management but I still can't see the problem.
Here is all related code:
Headerfile Interface:
NSButton * myButton;
Headfile:
@property (nonatomic, retain) IBOutlet NSButton * myButton;
Implementation:
NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
NSImage *image = [[NSImage alloc] init];
[image addRepresentation:bitmapRep];
[bitmapRep release];
LEAK -> [myButton setImage:image];
[image release];
I call this every second to update a picture. Everytime I call this the memory usage increases by 1MB until the memory is full.
I really can't see why there is a problem. Ok the Outlet is retained but shouldn't cocoa use the same space in memory over and over again instead of allocating new space every second?
I would really appreciate some hints.
Best regards,
Benedikt
_______________________________________________
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