Forums > Dev

atom_setparse and memory management

April 26, 2011 | 1:29 am

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


April 26, 2011 | 12:19 pm

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


April 27, 2011 | 1:46 am

Hi Andrea,

thanks. Sounds quite logical…

Best,
Ádám


Viewing 3 posts - 1 through 3 (of 3 total)