[PD] dsp external pointer problem

Claude Heiland-Allen claude at goto10.org
Thu May 12 11:09:36 CEST 2011


Hi,

Unrelated to your issue, perhaps, but I thought this work mentioning:

On 12/05/11 09:34, Ahmet Kizilay wrote:
> t_int *ak_addthese_tilde_perform(t_int *w) {
[snip]
>    t_sample ** ins = getbytes(sizeof(t_sample *) * 2);
[snip]

There's a memory leak here (no corresponding call to freebytes() or 
whatever it is called)!  And technically it's not "realtime-safe" to 
allocate memory in perform method (but this doesn't matter so much with 
the current Pd implementation, afaik).

I suggest allocating this memory in the constructor (new method) (and 
freeing it in the destructor), because you (probably) already know the 
number of inlets in the constructor (otherwise allocate in the dsp add 
method).


Claude
-- 
http://claudiusmaximus.goto10.org



More information about the Pd-list mailing list