[metapost] More on memory leaks

Taco Hoekwater taco at elvenkind.com
Mon Oct 10 13:25:59 CEST 2011


Hi Matthew,

On 10/05/2011 07:08 PM, mskala at ansuz.sooke.bc.ca wrote:
> The basic rationale for
> dynamic allocation (being able to accomodate objects whose numbers and
> sizes are unpredictable) doesn't seem to apply here because the number
> data structures always go with their parents anyway, and we are already
> managing the parents dynamically.

Pretty soon, there will be other numerical data types added for 
arbitrary precision calculations. Such objects have to be dynamically 
(de)allocated, and the current situation is a precursor for that.

I believe that the main reason for the memory leaks there are at the 
moment is that when I converted the static types in the original pascal 
code to dynamic C structures, I have tried to be too 'smart' about 
saving memory, creating separate node structures for each of the node 
types (I have already removed some of these distinctions). If instead 
all nodes would have the exact same internal structure, then the memory 
management would be a lot easier, and that is how I intend to fix the 
problem.

Best wishes,
Taco


More information about the metapost mailing list