[PD-dev] pdstring's crashing

Mathieu Bouchard matju at artengine.ca
Wed Jul 25 08:13:27 CEST 2007


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


More information about the Pd-dev mailing list