[metapost] Serial numbers, memory leak
mskala at ansuz.sooke.bc.ca
mskala at ansuz.sooke.bc.ca
Tue Oct 4 17:53:59 CEST 2011
I became interested in the "independent variable serial number overflow"
issue because I have a project for which it's a show-stopper. I know it's
going to be a hard problem to fix, because it's been known and unfixed
since 2006 (possibly earlier), it exists in MetaFont as well, and it was
acknowledged and not fixed by Knuth himself. Nonetheless, I need at least
a workaround for it before I can proceed with my own project, so I checked
out the current SVN version of MetaPost and took a look.
The current SVN version of MetaPost seems to have a different (possibly
related) problem that masks the serial-number overflow problem, namely
some kind of memory leak.
Here's my test code:
for i:=1 upto 100:
for j:=1 upto 1000:
for k:=1 upto 1000:
numeric x;
x:=i+j/10+k/100;
endfor;
endfor;
message decimal i;
endfor;
This tries to run 100 million iterations, printing a number after each
million. With the current SVN version of MetaPost, which identifies
itself as 1.760, it gets up to 3 and then says "Out of memory." With the
current TexLive 2011 version, which identifies itself as 1.504, it
actually goes all the way up to 100, but I suspect it's not correctly
detecting the serial number overflow (because other code fails, and I
haven't found any indication on the Net that anyone has really fixed the
serial number issue).
Any suggestions on where to look for this? One thing I suppose I can try
is to just binary-search on different revisions from the repository; it
should be possible to find the earliest version that has the "out of
memory" behaviour as opposed to some other behaviour, and that should give
a good clue as to what is causing the memory overflow. But maybe readers
here can suggest something a little more precise to look at.
--
Matthew Skala
mskala at ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/
More information about the metapost
mailing list