Memory zombie


#1

We have a problem with ShinobiCharts.

We created an own subclass of a view with on it a chart.

The chart is created in the init of the view and attached to a strong property of the subclass.

When the subclass get released (we use ARC btw) the chart gets released as well, so far so good.

But some memory of the chart is not (it is not a real leak, somehow they are still have a reference to them).

This is what we find with the XCode Instruments:

#AddressCategoryTimestampLiveSizeResponsible LibraryResponsible Caller

00x5c69000Malloc 24,00 KB00:03.358.642•24576GLEnginegleCreateProgramObjectNamed

10x6485000Malloc 24,00 KB00:03.360.666•24576GLEnginegleCreateProgramObjectNamed

20x6c37000Malloc 24,00 KB00:03.362.915•24576GLEnginegleCreateProgramObjectNamed

30x6c3d000Malloc 24,00 KB00:03.365.099•24576GLEnginegleCreateProgramObjectNamed

40x6c43000Malloc 24,00 KB00:03.367.581•24576GLEnginegleCreateProgramObjectNamed

50x6c49000Malloc 24,00 KB00:03.369.796•24576GLEnginegleCreateProgramObjectNamed

60x6c4f000Malloc 24,00 KB00:03.372.338•24576GLEnginegleCreateProgramObjectNamed

70x6c55000Malloc 24,00 KB00:03.374.514•24576GLEnginegleCreateProgramObjectNamed

80x6c7d000Malloc 24,00 KB00:03.377.190•24576GLEnginegleCreateProgramObjectNamed

90x6c8f000Malloc 24,00 KB00:03.379.165•24576GLEnginegleCreateProgramObjectNamed

100x6c95000Malloc 24,00 KB00:03.381.475•24576GLEnginegleCreateProgramObjectNamed

110x6cbd000Malloc 24,00 KB00:03.383.924•24576GLEnginegleCreateProgramObjectNamed

120x6cc3000Malloc 24,00 KB00:03.387.244•24576GLEnginegleCreateProgramObjectNamed

130x6cc9000Malloc 24,00 KB00:03.388.977•24576GLEnginegleCreateProgramObjectNamed

140x6ccf000Malloc 24,00 KB00:03.390.994•24576GLEnginegleCreateProgramObjectNamed

150x6cd5000Malloc 24,00 KB00:03.393.051•24576GLEnginegleCreateProgramObjectNamed

160x6cdb000Malloc 24,00 KB00:03.395.158•24576GLEnginegleCreateProgramObjectNamed

170x6ce1000Malloc 24,00 KB00:03.397.614•24576GLEnginegleCreateProgramObjectNamed

180x6ce7000Malloc 24,00 KB00:03.399.686•24576GLEnginegleCreateProgramObjectNamed

190x5d2f000Malloc 24,00 KB00:24.019.676•24576GLEnginegleCreateProgramObjectNamed

etc…

A detail of a object shows:

   0 GLEngine gleCreateProgramObjectNamed

   1 GLEngine glCreateProgramObjectARB_Exec

   2 OpenGLES glCreateProgram

   3 app -[SChartGLView compileShaders]

   4 app -[SChartGLView initWithFrame:]

   5 app -[SChartCanvas initWithFrame:usingChart:]

   6 app -[ShinobiChart initialiseChart]

   7 app -[ShinobiChart initWithFrame:]

   8 app -[GraphView initWithName:parent:frame:andID:] GraphView.m:54

The charts functions correctly, is shown etc. But after showing new / multiple charts, the memory it uses get more and more, which is of course a problem.

Is this a know issue? Should we release something or call a cleanup function?

Any help is appreciated,

Best regards, Harm


#2

Hi Harm,

It does look like something isn’t being released properly - are you sure you are releasing, and not keeping any references, to the chart and its components? If so, and you are still encountering issues with this, I’m happy to take a look at this for you - just send in a project which demonstrates this leak to info@shinobicontrols.com :slight_smile:

Best,

Simon


#3

Thank you for the suggestion. This helped me to find the problem.

We copied part of the project into a new very simpified project to be able to demonstrate the problem. After which we noticed in this case the problem did not exists.

I checked the parent view (which releases the chart) for releasing, and that did happen. Apparently the view was alloc twice, due to an error, and only one of every two alloced views were released. We fixed this and the data allocation of the charts were gone indeed.

Sorry for the inconvience, and thanks again for pointing me in the right direction.