Loading a plist into CCDictionary memory consumption


#1

Hi All,

I have a data plist which is about 5MB which i load into a dictionary at the launch of the game,

When i profiled it (using xcode instruments) i observe that the memory consumption of the game before loading the plist is about 100MB and after its 200MB,
And there is nothing happening in between loading the dictionary which im sure of, why such an increase?

Instruments show the setObjectUnSafe method as the culprit, is it true?

If so how to optimize the memory consumption and bring it down?

Thanks…


#2

Anyone??

Hari Krishna wrote:

Hi All,
>
I have a data plist which is about 5MB which i load into a dictionary at the launch of the game,
>
When i profiled it (using xcode instruments) i observe that the memory consumption of the game before loading the plist is about 100MB and after its 200MB,
And there is nothing happening in between loading the dictionary which im sure of, why such an increase?
>
Instruments show the setObjectUnSafe method as the culprit, is it true?
>
If so how to optimize the memory consumption and bring it down?
>
Thanks…


#3

At first, avoid using such plists (there are no real reasons to use them). At second, each object in CCDictionary/CCArray/CCString hierarchy is inherited from CCObject and have all its fields; so you can create own data structures with only one field that determines kind of underlying data structure, and use CCSAXParser to create data hierarchy from you XML file.