Memory issue VM SchartCrosshair and VM SchartGrandientView



I encounter some memory spikes every time I open a chart, that I cannot manage to release fully on ViewDidDisappear

Two components seems to be gradually increasing, quite at the same rhythm (see picture below)-

Here is my ViewDidDisappear, what could I be missing ?



if(_chart != nil)
        [_chart removeFromSuperview];
        _chart.datasource = nil;
        _chart.delegate = nil;
        _chart = nil;
    if(_chart2 != nil)
        [_chart2 removeFromSuperview];
        _chart2.datasource = nil;
        _chart2.delegate = nil;
        _chart2 = nil;
    if(_chart3 != nil)
        [_chart3 removeFromSuperview];
        _chart3.datasource = nil;
        _chart3.delegate = nil;
        _chart3 = nil;


Some more info

We ware using annotations on chart


Any feedback ? Sooner or later by opening/closing graph (even with a few points on each serie), I get a vm-pageshortage crash



I have no annotations, but see the same problem with huge amount of memory allocated for SChartCrosshair.

Up to 10Mb per object ! So it is quite problematic to have more than 5 charts on the screen at the same time. The app is crashing with vm-pageshortage.

I guess that SChartCrosshair somehow duplicates underlying image in memory, as it must float over it. But it is just speculation.Any light on the reducing memory overhead when using SChartCrosshair would be very appreciated!



Hi all,

Unfortunately, this is due to an issue with the CoreGraphics logic used to draw the crosshair ellipse and lines.

We have since moved to using layers for drawing these, which in our testing no longer causes the crosshair to use such vast amounts of memory. This fix will be included in our next version which should be out in a week or so. I’ll make a note to update this post when it goes live.

If you’re desperately in need of a solution, you may have some luck subclassing SChartCrosshair and then overriding its drawRect: method, to merely call [super drawRect:rect].

Kind regards,