Nicolas Cannasse wrote:
Justin Collins a écrit :
 > Okay, granted. However, what about 124 locals at the top-level? That
seems to fail, as well.
As I understand it, local variables are only copied into functions if they are accessed from those functions. This particular test seems to assume all local variables may be copied, whether they actually will or not. Is this correct?

Yes, it will fail as well.

My problem is that I generate a lot of short-lived, temporary variables. They are not going to be accessed from inside other functions (so there is no danger of having to copy 100+ variables to the function stack). I don't want them to be globals, because I want them garbage collected as soon as possible. What are my options?

Use {} blocks to separate the stacks :

{
 var v1,v2....v50;
 ...
}
{
  var v51,v52....v100;
  ...
}

This will ensure that your current stack never reach 128.

Best,
Nicolas


Aha, thank you.

It will take some thinking for me to figure how to use this...and playing around with how it interacts with functions and other control structures.

-Justin

--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to