Best practices to avoid memory leaks for shinobi charts in UITableViewCell (1)


#1

Dear Shinobi community, we’ve been using Shinobi charts in our app for the last 10+ months and it just works great and our users love it. Over the last couple of months, there were few changes to our app:

  1. iOS 9.x upgrade 2) Shinobi charts upgrade to 2.8.5 (from 2.6.0)

And our app is now crashing after the controller that displays the charts is loaded few times. There is about 50MB of memory being retained on every load. While I am going through Instruments tutorials and looking at other options, I don’t have a handle on this one yet.

Our code has the following logic inside cellForRowAtIndex:

CustomCell* cell = [tableview dequeueReusableCellWithIdentifier:@“customCell”];

chart = [[ShinobiChart alloc] initWithFrame:<frame>];

[self setChartStyles:chart];

[chart removeFromSuperView]; // added this after reading on one of the previous posts, but has no effect

[cell.contentView addSubview:chart];

What could be wrong in here that causes the leak? Thanks for your help!


#2

The same with this issue. 
The memory always increase and not be destroyed. 
App will crashes after go back this view which contain the chart in tableviewcell.


#3

This is a duplicate of https://www.shinobicontrols.com/forum/shinobicontrols/2016/4/best-practices-to-avoid-memory-leaks-for-shinobi-charts-in-uitableviewcell