| Hi Istvan,
I don't change, reallocate or free the auxp pointer. But the
use of the buffer after the end of performance for a small
amount of time is possible. That would explain why the
performance went ok and the seg-fault happens at the end.
Hmm, I just call the redraw() method in the process function
and only when a new input frame is ready (fsig). Probably
there is an Csound API function to know before Csound quit
so I could set a value that the drawing function doesn't
access the buffer then. For your note of the changing
buffersize, would this be the safe way?
if(p->buffer.auxp==NULL || (long) (buffersize *
sizeof(MYFLT)) > p->buffer.size)
csound->AuxAlloc(csound, buffersize*sizeof(MYFLT),
&p->buffer);
buffer = (MYFLT*)p->buffer.auxp;
for(int i=0; i
> Does your window class possibly use the buffer after the
> end of performance (even if only by a small amount of
> time) ? All memory allocated with AuxAlloc is
> automatically freed at end of performance (and also at end
> of section). Another possible error is if you change,
> reallocate, or free the auxp pointer in an AUXCH structure
> in any way other than calling AuxAlloc with a new size. In
> general, you should consider the contents of the AUXCH
> structure read-only.
>
> Simon Schampijer wrote:
>
> > I wonder if there is a way of tracking down segmentation
> > faults reported by csound which I get during the
> > development of plugin opcodes. Csound tidy up:
> > Segmentation fault (I get them after the performance
> > finishs correctly) One thing that could cause the
> > problem is memory allocation which is done by using the
> > AUXCH structure.
> > in the data structure:
> > AUXCH buffer;
> > the init function:
> > if(p->buffer.auxp==NULL)
> > csound->AuxAlloc(csound, buffersize*sizeof(MYFLT),
> > &p->buffer);
>
> Note that this is not safe if a new call of the opcode
> requests a larger buffer size, assuming that the buffer
> size depends on some parameter of the opcode and is not
> constant. --
> Send bugs reports to this list.
> To unsubscribe, send email to
> csound-unsubscribe@lists.bath.ac.uk
--
Send bugs reports to this list.
To unsubscribe, send email to csound-unsubscribe@lists.bath.ac.uk |