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 protected])

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