I am creating an application related to graphics with ARC enabled, in which there are two different views on the chart: -One small view that I have to change with the click of a button (using the reset data). The second view is the large one, on which the schedule changes when buttons are pressed, such as "1 day", "3 days", "5 days".
The problem that I encountered is that after 15-20 minutes of continuous use of the application it crashes with the log .... "CAAnimation could not allocate bytes." When I analyzed in the profile, I found out that when a small graph loads live bytes of bytes at 2-3 mb, and when large graphs load, live bytes jump to 4-5 mb and live bytes, they never go down. I disabled all graph objects when exiting the view, but even then the memory was not released.
when switching to the following graph, I call this method:
-(void)removePlot { for(CPTPlot* plot in [graph allPlots]) { plot.dataSource = nil; plot.delegate = nil; [plot deleteDataInIndexRange:NSMakeRange(0, plot.cachedDataCount)]; [graph removePlot:plot]; } }
and when exiting the view, I call this method:
-(void)removeGraph { [axisSet removeFromSuperlayer]; axisSet=nil; [self removePlot]; generationPlot=nil; [graph removePlotSpace:plotSpace]; plotSpace=nil; [graph removeFromSuperlayer]; graph=nil; [hostView removeFromSuperview]; hostView=nil; headerList=nil; graphDetailList=nil; graphList=nil; dataList=nil; plotsArray=nil; }
Many people have encountered this problem before, but the answer will not work for me yet. If anyone has any ideas on this ... please help.
source share