moin
i get weird random crashes when using [any2string] of bryan's pdstrings library.
unfortunately i have not been able to reproduce them reliably (as a matter of fact it only crashes halfway through our performance :-()
we have spent some time now in tracking the error down, but to real avail.
the only thing that is rather sure is, that it crashes in the freebytes(text) call in any2string_anything() with "***glibc detected *** free(): invalid next size(fast): 0x0823e3f0 ***"
nevertheless i cannot find anything wrong.
has anybody else experienced this before? bryan? any insights would be helpful
i'll file a bug-report later...
mfga.dsr IOhannes
moin [ij]ohannes, moin all,
egad...
obviously, you've had a look at the code (which I hadn't recently until reading your mail)... looking at it now, all I can think of is that for some reason, "text" hasn't actually got anything but junk in it (although that would probably lead to "double-free or corruption" errors... and "text" ought to be filled by the binbuf_gettext() call [which should at least return getbytes(0) --> calloc(1,1) in pathological cases] ... any2string_anything() adds the "text"-terminating NUL itself, so strlen() oughtn't to be goofing up either... so that's probably not it :-/)...
is there maybe anything fiendishly tricky about the strings you're converting?
i've successfully used multiple concurrent parallel [any2string]s fed by speech-rate sentence lists and feeding into a single [sendOSC] for hours at a time without seeing anything like this -- and that patch tested ok a few months ago (maybe for a 1/2 hour)... very strange...
... all that said, there's got to be a better way to do the conversion than to delegate the conversion to binbuf_gettext(): all that allocation and de-allocation at every message just makes my skin crawl... maybe we should find a better way to do it... or just use Martin's string patches ;-)
marmosets, Bryan
On 2007-07-24 23:14:32, IOhannes m zmölnig zmoelnig@iem.at appears to have written:
moin
i get weird random crashes when using [any2string] of bryan's pdstrings library.
unfortunately i have not been able to reproduce them reliably (as a matter of fact it only crashes halfway through our performance :-()
we have spent some time now in tracking the error down, but to real avail.
the only thing that is rather sure is, that it crashes in the freebytes(text) call in any2string_anything() with "***glibc detected *** free(): invalid next size(fast): 0x0823e3f0 ***"
nevertheless i cannot find anything wrong.
has anybody else experienced this before? bryan? any insights would be helpful
i'll file a bug-report later...
Bryan Jurish wrote:
all that allocation and de-allocation at every message just makes my skin crawl... maybe we should find a better way to do it... or just use Martin's string patches ;-)
When I made the [str] external that uses the string atom, I found that constantly reallocating/resizing memory eventually crashed pd so I ended up just allocating a big wad of space up front for each [str]. If the user can set the initial size of this memory then the amount of wasted ram may be minimized, but the default is quite large.
Martin
moin Martin,
Yep, I just had another glimpse at your [str] code too, and noted the recent change ;-)
I suppose the best workaround for [any2string] is probably going to be pre-allocation too, but it's too late for me to implement that tonight; maybe tomorrow...
marmosets, Bryan
On 2007-07-25 01:00:48, Martin Peach martin.peach@sympatico.ca appears to have written:
Bryan Jurish wrote:
all that allocation and de-allocation at every message just makes my skin crawl... maybe we should find a better way to do it... or just use Martin's string patches ;-)
When I made the [str] external that uses the string atom, I found that constantly reallocating/resizing memory eventually crashed pd so I ended up just allocating a big wad of space up front for each [str]. If the user can set the initial size of this memory then the amount of wasted ram may be minimized, but the default is quite large.
Martin
On Tue, 24 Jul 2007, Martin Peach wrote:
Bryan Jurish wrote:
all that allocation and de-allocation at every message just makes my skin crawl... maybe we should find a better way to do it... or just use Martin's string patches ;-)
When I made the [str] external that uses the string atom, I found that constantly reallocating/resizing memory eventually crashed pd so I ended up just allocating a big wad of space up front for each [str]. If the user can set the initial size of this memory then the amount of wasted ram may be minimized, but the default is quite large.
Consider using Valgrind. It's essentially an emulator of your CPU that checks whether each instruction makes sense in terms of previous calls to malloc() and free(). It can detect lots of pointer errors and give you backtraces of both the error that happened and the original allocation. It can be configured to report on memory leaks as well.
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada
moin again,
having had a closer look, i'm 99.9% certain that my code is at fault here (said error is typically produced by writing beyond an array's bounds); so now I've stopped writing the trailing NUL to the string populated by binbuf_gettext() -- there might still be a bounds problem with other dynamically allocated arrays (x->x_argv comes to mind), but since freebytes(text) is failing, "text" looks like the prime suspect to me...
the new code has been checked into cvs as externals/moocow/pdstring v0.04 ... let me know if it works (or doesn't)... and send me some sequence of inputs that reproduces the error if you can find one...
marmosets, Bryan
On 2007-07-24 23:14:32, IOhannes m zmölnig zmoelnig@iem.at appears to have written:
crashes in the freebytes(text) call in any2string_anything() with "***glibc detected *** free(): invalid next size(fast): 0x0823e3f0 ***"
Bryan Jurish wrote:
moin again,
the fastest lurker on the list...
the new code has been checked into cvs as externals/moocow/pdstring v0.04 ... let me know if it works (or doesn't)... and send me some sequence of inputs that reproduces the error if you can find one...
thanks bryan. i have not been able to test your changes under our conditions, i'll tell you when i know more.
mfg.asdr IOhannes