atom_setparse and memory management

Apr 26, 2011 at 1:29am

atom_setparse and memory management

Hi Developers,

I would just like to clarify something from the Documentation. The docs says that if I pass 0 and NULL to the ac and av parameters (respectively) then atom_setparse will allocate automatically an array of atoms with the needed length for me. On the other hand, it also says that ‘Any allocated memory should be freed with sysmem_freeptr().’ My question is: should I free the internally allocated atom array at some point if I passed 0-NULL as parameters or will Max take care of this?

Thanks,
Ádám

#56603
Apr 26, 2011 at 12:19pm

Hi Ádám.

Yes, you have to free the internally allocated memory – think about it, even if a global register of the allocated stuff was kept, Max would have no way to know when to free things in it… does it make sense?

best
aa

#202929
Apr 27, 2011 at 1:46am

Hi Andrea,

thanks. Sounds quite logical…

Best,
Ádám

#202930

You must be logged in to reply to this topic.