• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
memory leak with menu icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memory leak with menu icon


  • Subject: memory leak with menu icon
  • From: Tavis <email@hidden>
  • Date: Tue, 25 Nov 2003 10:19:58 -0800

Hi,

I can't solve this memory leak. I can't release it. I am adding an icon
to a menu like this (commented out code does not work either):

item = [[NSMenuItem alloc] initWithTitle:title
action:@selector(myAction:) keyEquivalent:@""];

image = [[NSWorkspace sharedWorkspace]
iconForFile:iconPath];
[image setSize:NSMakeSize(16.0,16.0)];
[item setImage:image];

[item setTarget:self];
[theMenu insertItem:item atIndex:4];

then later I clear the menu like this:

while(item=[enumerator nextObject]){
if([item action]==@selector(myAction:)){
[theMenu removeItem:item];
}
}

but the memory does not free up and next time I build the menu more
memory gets consumed

If i take out the [item setImage:image]; all is fine.

Any ideas?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Double-clicking in NSOutlineView
  • Next by Date: Doc-based app, text fields, and losing focus
  • Previous by thread: Re: Double-clicking in NSOutlineView
  • Next by thread: Doc-based app, text fields, and losing focus
  • Index(es):
    • Date
    • Thread