atom_setparse and memory management

$Adam's icon

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

andrea agostini's icon

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

$Adam's icon

Hi Andrea,

thanks. Sounds quite logical...

Best,
Ádám