Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>So, after painfully turning off code section by section, I tracked the leak to the drawRect method in the subview controller. By adding NSAutoreleasePools everywhere I could and releasing the NSBezierPath, the leak was plugged.</p> <p>Thanks for giving me an outlet to "think out loud" about this!</p> <pre><code>- (void)drawRect:(NSRect)dirtyRect { // Drawing code here. NSAutoreleasePool* uberpool = [[NSAutoreleasePool alloc] init]; NSPoint minPoint = [self findMinValues]; NSPoint maxPoint = [self findMaxValues]; float xScale = ([self bounds].size.width)/(maxPoint.x - minPoint.x); float yScale = [self bounds].size.height/(maxPoint.y - minPoint.y); [[NSColor whiteColor] set]; NSRect fillArea = [self bounds]; [NSBezierPath fillRect:fillArea]; NSBezierPath *pathForPlot = [[NSBezierPath alloc] init]; if(dataCount&lt;maxRawPlotData){ if(dataCount&gt;1){ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSPoint p1 = myData[0]; p1.x = (p1.x-minPoint.x)*xScale; p1.y = (p1.y-minPoint.y)*yScale; [pathForPlot moveToPoint:p1]; [pool drain]; } for(int i=1; i&lt;dataCount; i++){ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSPoint p = myData[i]; p.x = (p.x-minPoint.x)*xScale; p.y = (p.y-minPoint.y)*yScale; [pathForPlot lineToPoint:p]; [pool drain]; } } else{ unsigned long firstPointToPlot = dataCount-maxRawPlotData; NSPoint p1 = myData[firstPointToPlot]; xScale = [self bounds].size.width/maxRawPlotData; minPoint.x = p1.x; p1.x = (p1.x-minPoint.x)*xScale; p1.y = (p1.y-minPoint.y)*yScale; [pathForPlot moveToPoint:p1]; for(unsigned long i=firstPointToPlot; i&lt;dataCount; i++){ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSPoint p = myData[i]; p.x = (p.x-minPoint.x)*xScale; p.y = (p.y-minPoint.y)*yScale; [pathForPlot lineToPoint:p]; [pool drain]; } } [[NSColor blackColor] set]; [pathForPlot stroke]; [pathForPlot release]; [uberpool drain]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload