POV-Ray : Newsgroups : povray.beta-test : long function with crash : Re: long function with crash Server Time
30 Jul 2024 00:18:22 EDT (-0400)
  Re: long function with crash  
From: Thorsten Froehlich
Date: 8 Feb 2002 11:14:31
Message: <3c63f967$1@news.povray.org>

news:5bb76ucbrgq3c34spn7lfs2mks7k87g7gq@4ax.com...
> On 7 Feb 2002 16:10:07 -0500, ingo <ing### [at] homenl> wrote:
> > I can confirm that the scene crashes when Count is bigger that 441.
>
> At begining of macro I have added function:
> #local N=function{2*f_noise_generator(x,y,z,2)-1};
> Then I have changed body of loop to:
>       P(
>         x+X*N(x+C,y,z),
>         y+Y*N(x,y+C,z),
>         z+Z*N(x,y,z+C)
>       )
> With such changes this scene crashes when Count is bigger than 598.
> Looks like crash is connected with number of tokens in expression.

Functions still have a size limit (the size of the function VM code is
limited to 2^16 instructions).  The function compiler does test if the
functions runs over this limit, but for some reason this test seems to fail.
At least this explains the problem (I have not looked into it yet)...

It should be noted that when this problem is fixed (maybe beta 12), POV-Ray
will issue an error message and refuse to continue parsing.  For this reason
I would suggest you add some kind of automatic splitting into several
functions, i.e. doing some kind of recursion when the count is more than say
500.  As you can have up to 2^16 functions per scene, this should be
sufficient for a count of about 2 million (or about 500000 on a 32 bit
system). Unfortunately, then you have reached the absolute size limit. BTW,
you need to do this on a 64 bit system - the functions will consume about 16
GB of memory! ;-)

    Thorsten


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.