[metapost] problems with memory in metapost

Taco Hoekwater taco at elvenkind.com
Sat May 8 08:07:23 CEST 2010


Taco Hoekwater wrote:
> Yogeshwarsing Calleecharan wrote:
>> I set the memory limit to a very high value (I don't know if this is 
>> allowed). I get the message:
>> This is MetaPost, version 1.208 (kpathsea version 3.5.7dev) (mem=mpost 
>> 2009.12.12)  7 MAY 2010 11:52
>> **myfigu.mp
>> (./myfigu.mp
>> ! MetaPost capacity exceeded, sorry [main memory size=20000000].
>> _wc->withpen
>>             .currentpen.withcolor.currentcolor
>> gpdraw->...ptpath[(EXPR0)]_sms((EXPR1),(EXPR2))_wc
>> .else:_ac.contour.ptpath[(...
>> l.48057 gpdraw(0,517.1a,166.4b)
> Looks like some form of recursion takes place, because this is the
> same line number (with a different main memory size).

Yogeshwarsing sent me the files offlist. There is no recursion after
all, it just needs lots of memory. As I initially suspected, something
went wrong in the regeneration of the mem file (20000000 is actually

There was a bug in mpost 1.208 that caused it to report the current
main_memory value stored in texmf.cnf instead of the main_memory value
used by the mem file. This is why there was only a change in the
error report: it was actually still using the old mem file.

Building an updated mem file on a texlive installation manually
(without fmtutil) should go like this:

   1. go to the directory where the input file figu.mp lives
   2. run kpsewhich mpost.mem, this will report something like this

   [taco at ntg NewFolder]$ kpsewhich mpost.mem

   3. go to the reported directory (/opt/tex/texmf-linux-64/web2c in
   my case)

   4. run mpost -ini mpost in that directory
   5. go back to figu.mp's directory.
   6. processing should now work.

The file actually needs 11552656 words of main memory.

Best wishes,

More information about the metapost mailing list