MetaPost stack size exceeded
Reinhard Kotucha <[email protected]>
| Newsgroups | gmane.comp.tex.tetex.general |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "Remko" == Remko Troncon <[email protected]> writes: > Hello, I have a problem with metapost in tetex (2.0.2). When i > run mpost on a function which has more than 18 recursions, i get > the following error message: > ! MetaPost capacity exceeded, sorry [parameter stack > size=150]. > I didn't find any parameter in the texmf file which had as a > value 150. I changed some other parameters (stack_size, > param_size, stack_size.mpost, param_size.mpost, ...) to bigger > values, but without any luck: i keep on getting the exact same > error message. Does anyone know how to solve this problem ? Metapost's parameter stack size cannot be configured. Maybe it should. You can compile teTeX again whith an other value. In the source tree edit line 190 in file texk/web2c/mp.ch and run `make world'. I replaced 150 by 1500. mpost "\\relax tracingstats:=1;end" produces the file mpout.log: This is MetaPost, Version 0.641 (Web2C 7.5.2) (mem=mpost 2004.2.13) 13 FEB 2004 21:59 **\relax tracingstats:=1;end Here is how much of MetaPost's memory you used: 1 string out of 31350 9 string characters out of 726396 4261 words of memory out of 1500001 477 symbolic tokens out of 9500 0i,62n,0p,1b stack positions out of 300i,300n,1500p,200000b 0 string compactions (moved 0 characters, 0 strings) Note the "1500p" near the bottom, you get "150p" now. So far this sounds simple, but it is quite dangerous. You cannot set variables as you like, many depend on others. For instance in texk/web2c/mp.web, line 360: @d hash_size=2100 {maximum number of symbolic tokens, must be less than |max_halfword-3*param_size|} Increasing the parameter stack is quite expensive. max_halfword is 65535, BTW. Probably you can optimize your algorithm. If you get it running with a larger parameter stack, then add the line tracingstats:=1; to get the statistics into the .log file. I suppose that you pass too many arguments from one iteration step to the next one and that you need too many iterations. If the value of an argument doesn't change from one recursion level to the next it is probably better use a global variable. Reducing the number of iterations is a challenge. I hope that you are a mathematician. Mathematicians are happy if they have such a problem to solve, other people are happy if they don't have any problems at all... Regards, Reinhard -- ---------------------------------------------------------------------------- Reinhard Kotucha Phone: +49-511-4592165 Marschnerstr. 25 D-30167 Hannover mailto:[email protected] ---------------------------------------------------------------------------- Microsoft isn't the answer. Microsoft is the question, and the answer is NO. ----------------------------------------------------------------------------