[PD-dev] Malloc Error occuring with PD 0.41.4

Mathieu Bouchard matju at artengine.ca
Mon Aug 31 17:44:47 CEST 2009

On Fri, 28 Aug 2009, james murray wrote:

> It steadily creeps up in memory used until I have approx 140 mb of free 
> memory on the computer.  And although I noticed that it occasionally 
> flashed all the way down to only 6 - 9 MB of free memory at some points 
> for a flickering moment, when it finally crashed it was listing free 
> memory at around 133 mb.  It took almost two hours for this to occur.

This is a kind of bug called a Memory Leak. Look for those words, to find 
a tool that can look for those bugs. I don't know about OSX. I'd use 
Valgrind but I'm on Linux.

The direct cause of the crash looks definitely like a mishandling of 
an Out-of-Memory situation, but everybody would agree that the solution 
to that is to fix the leak and not to improve the Out-of-Memory handler...

When I didn't have Valgrind, I used to measure the memory usage over a 
long time, use it to figure out how much memory was lost per video frame, 
and use that information as a hint. But the hint can only be used by 
someone who has had a good overview of the program's code. It should also 
be noted that the amount lost will be a little bigger than the size of the 
offending allocation, as malloc needs some space for its own 
administration... (typically 4-16 bytes more per malloc call)

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard, Montréal, Québec. téléphone: +1.514.383.3801

More information about the Pd-dev mailing list