Collections in external SDK
Some questions , maybe any of you experts could help a newbie :) My external is working properly, jut i’m not sure if i cause some memoryleaks with it or not :D
1, If I’m the owner ("noun") of the dictionary object and I "dictionary_clear(dict)" it, it says in the documentation: "This method will free the objects in the dictionary." Is this mean all included "subdictionaries" appended to it will get a "object_free(subdict)" so those will be unregistered and the memory of the subdicts will be freed up too? No need to handle them by myself?
2, If (1) is true, then should i call "dictionary_clear()" before "object_free(dict)"? or "object_free(dict)" will clear it’s subdictionary contect by itself?
3, If (1) is true and all I want to do is to create and output a dictionary with subdictionaries inside my object, then should i keep track the subdictionary pointers and names, or if they are registered and appended to the main ("dictionary_appenddictionary()") they will be deleted automatically when i send "dictionary_clear()" or "object_free(dict)" to the main dictionary?
thanx for your help in advance!
thanx Nicolas, i was using the pdf version of the API documentation… but it seems it’s a bit different to the html version so maybe the html can clear up some things for me :)
Regarding (3) i just meant the main dictionary object (owned by my external) will be cleared and filled up with new values on every bang and send out the name on an outlet. I was wondering if I create and append a new dictionary to the main dict, then I guess I don’t need to track the name and pointer to that, as it will be freed automaticly when the main dictionary will be freed or cleared. I guess this "soon as you appended a dictionary inside another dictionary, you also transfer ownership." means exactly that, i don’t need to save the pointers and names if i don’t need them, as the main dictionary will be free them…
thanx again Nicolas, loving your github collection of helpers!