I’d like to know when to definitely call sysmem_freeptr
and why Max crashes in some cases even when pointers are local.
Maybe it would be great if anyone who reads the post and can think of an unnamed case
when to call sysmem_freeptr (or handle) or not to just adds it to the post.
I was getting unsure because of the following method:
t_object* get_object_by_scr_name(t_generic *x, t_symbol* scr_name_to_find)
t_object *parent_patcher = NULL;
t_object* obj_to_find = NULL;
t_symbol *scr_name_of_obj = NULL;
t_object *box = NULL;
//get the object's parent patcher
t_max_err err = object_obex_lookup(x, gensym("#P"), (t_object **)&parent_patcher);
if (err != MAX_ERR_NONE)
//if parent patcher not found
box = jpatcher_get_firstobject(parent_patcher);
scr_name_of_obj = jbox_get_varname(box); // scripting name
if (scr_name_of_obj == scr_name_to_find)
obj_to_find = jbox_get_object(box);
box = jbox_get_nextobject(box); // iterate
if (scr_name_of_obj != scr_name_to_find)
object_error((t_object*)x, "object not found");
// crashes if all sysmem_freeptr are executed
yes this helps a lot. Thank you once again!
Log in to reply
Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.