lua: constant table overflow

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

lua: constant table overflow

Siome Klein Goldenstein
I guess this is a weird question, but anyway...

I an animation system that exports the results in  a lua script.
I have another set of lua scripts that converts
this script in a 'rib' file  
(yes, I already have a preliminary and extremelly crude, 
binding of rib to lua based in write statements)

In a particularly large animation script (1845206 bytes)
lua gives me the following message before exiting w/o executing:

dilbert:maze2> mkmz
before exit, input =maze2-olua.lua
Active Stack:
        function dofile [in file (C)]
        main of mz2-defs.lua

Is there a limit on the size of files to be used as a
'dofile'?  May be it is trying to precompile before 
executing and running out of memory?

For now (my deadline is tuesday) I'll just
have to try to split the file in at least two,
and see if it works...

Any ideas are really welcomed
Siome
-- 
----------------------------
Siome Klein Goldenstein
[hidden email]
http://www.cis.upenn.edu/~siome

Reply | Threaded
Open this post in threaded view
|

Re: lua: constant table overflow

Luiz Henrique de Figueiredo
>In a particularly large animation script (1845206 bytes)
>lua gives me the following message before exiting w/o executing:
>
>dilbert:maze2> mkmz
>before exit, input =maze2-olua.lua
>Active Stack:
>        function dofile [in file (C)]
>        main of mz2-defs.lua

nao entendi? qual erro deu? "before exit, input =maze2-olua.lua" me parece 
mensagem sua, nao?

>Is there a limit on the size of files to be used as a
>'dofile'?

nao tem, mas da' erro para arquivos com muitas linhas (mais de 65000) se
$debug estiver ligao. mas da' erro explicito.

--lhf

Reply | Threaded
Open this post in threaded view
|

Re: lua: constant table overflow

Roberto Ierusalimschy
In reply to this post by Siome Klein Goldenstein
> dilbert:maze2> mkmz
> before exit, input =maze2-olua.lua
> Active Stack:
>         function dofile [in file (C)]
>         main of mz2-defs.lua

Are you sure this is the whole message? It seems the error message itself
is missing; it should appear just before the "Active Stack:", where
is the "before exit...".


> Is there a limit on the size of files to be used as a
> 'dofile'?  May be it is trying to precompile before
> executing and running out of memory?

If you are using the $debug directive, there is a limit of 64K lines in
each file, because the debugging information is stored in only two bytes:

> arraial:~/prj/lua> /usr/local/bin/lua -d temp
> lua: code too long (limit=64K);
>   last token read: `a' at line 65535 in chunk `temp'

Also, there is a limit in the size of the body of a control structure
(whiles, ifs, ...), because the jump instruction uses only two
bytes. Otherwise, there is no fixed limit. Anyway, there should be an error
message with some hints...

**PS:**
Is the error message the "constant table overflow" of the subject?? (I
noticed it only now). Are you using version 3.1? If yes to both questions,
then the problem is the number of different "constants" in your file
(string literals, real numbers, names of global variables). There is a
limit (again of 64K ;-) to the number of different constants each function
can manipulate. This limit is for functions, not for files; the "main" of a
file counts as one function. You can try spliting your "main" in some
functions to avoid this limit.

-- Roberto

Reply | Threaded
Open this post in threaded view
|

Re: lua: constant table overflow

Siome Klein Goldenstein
As in the last message...
> 
> **PS:**
> Is the error message the "constant table overflow" of the subject?? (I 
> noticed it only now). Are you using version 3.1? If yes to both questions, 
> then the problem is the number of different "constants" in your file 
> (string literals, real numbers, names of global variables). There is a 
> limit (again of 64K ;-) to the number of different constants each function 
> can manipulate. This limit is for functions, not for files; the "main" of a 
> file counts as one function. You can try spliting your "main" in some
> functions to avoid this limit.
> 
> -- Roberto
> 


Thanks Roberto.

I guess that was exactly the problem.   My "main" file was 
automatically generated and was composed only of functions calls.
It was really large (over 22Mb).

Before I received your message I simply split the file in
4,  and processed one by one...
Next time I'll follow your advice and create function
hrarchies.

Siome
-- 
----------------------------
Siome Klein Goldenstein
[hidden email]
http://www.cis.upenn.edu/~siome