Hello, I am writing a msp external in C and I need to know whether there is a function which is called when the object is deleted. I am using a malloc() function and I want to free the memory once the object is deleted.
Have look at simplemax example from the SDK, you’ll see that in your contstuctor (class_new) you define which method is called when the instance of the object is freed.
t_class *c = class_new("simplemax", (method)simplemax_new, (method)simplemax_free, (long)sizeof(t_simplemax), 0L /* leave NULL!! */, A_GIMME, 0);
Note that you can also use sysmem_newptr()/sysmem_free() to alloc/dealloc memory as part of the Max SDK.
Log in to reply
Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.