Forums > Dev

msp external in C

December 9, 2012 | 10:21 am

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.


December 9, 2012 | 11:15 am

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.


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