Search code examples
iosmemory-managementcore-animationcore-plot

CoreAnimation: failed to allocate xxxx bytes


I am developing an iOS app n which I am using core plot to draw the graphs. 15-16 graphs are getting plotted at a time an they all are needed. I have a sync button which takes the data from server and draws the graphs accordingly. Number of graphs can vary on each sync. Before drawing each chart I am releasing the earlier objects using the code:

[smartbarChartView.hostedGraph.axisSet removeFromSuperlayer];
smartbarChartView.hostedGraph.axisSet=nil; 
smartbarChartView.hostedGraph=nil;
smartbarChartView = nil;

Still when I sync for 2-3 times, I get the error CoreAnimation: failed to allocate xxxx bytes and application gets stuck.

Tried to resolve the issue for a whole day.

any guidance is highly appreciated.

Thanks in Advance!


Solution

  • Releasing the hosting view (smartbarChartView) will release the graph and all of its component parts including the axes and plots. Make sure that you're not holding onto strong references to the graphs or plots.