Got a problem here. I'm creating a MAAttachedWindow
, then hiding it when a certain event happens. Here's how the code looks:
-(void)toggleDetailShouldShow:(BOOL)show {
if (show) {
if (!attachedWindow) {
NSPoint buttonPoint = NSMakePoint(NSMidX([[someView someImageView] frame]),
NSMidY([[someView someImageView] frame]));
attachedWindow = [[MAAttachedWindow alloc] initWithView:view
attachedToPoint:buttonPoint
inWindow:window
onSide:12
atDistance:65.0];
//setup here
[attachedWindow setAlphaValue:0.0];
[[[someView someImageView] window] addChildWindow:attachedWindow ordered:NSWindowAbove];
[[attachedWindow animator] setAlphaValue:1.0];
}
}
else {
if (attachedWindow) {
[[[someView som开发者_Python百科eImageView] window] removeChildWindow:attachedWindow];
[attachedWindow orderOut:self];
[attachedWindow release];
attachedWindow = nil;
}
}
}
When this is triggered multiple times, my memory usage climbs steadily. Any reason why this is leaking?
This is a perfect situation to use Heapshot analysis.
The symptoms you describe are exactly the same as the symptoms I saw in Hex Fiend when writing that article.
More likely than not, whatever is leaking -- and it really is a leak in that your app is accreting memory -- is still connected to the rest of the app's object graph.
精彩评论