Knowing nothing at all about what you're
doing, I'm wondering -- could you make an array (or other data structure)
that holds all the values? I would think that if you were to replace
a not-needed value in an array with something else -- e.g. 0 -- then the
value that had been in that slot would be eligible for GC right at that
point (unless it was referenced elsewhere of course).
Could that solve your problem?
J. Merrill
| From:
|
Justin Collins <justin <at> presidentbeef.com>
|
| To:
|
Neko intermediate language mailing list
<neko <at> lists.motion-twin.com>
|
| Date:
|
03/03/2010 06:35 AM
|
| Subject:
|
Re: [Neko] neko_check_stack failure
|
| Sent by:
|
<neko-bounces <at> lists.motion-twin.com> |
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)