lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Apr 27, 2015 at 8:36 AM, Egor Skriptunoff
<egor.skriptunoff@gmail.com> wrote:
> On Mon, Apr 27, 2015 at 5:55 PM, Coda Highland <chighland@gmail.com> wrote:
>>
>> You've ignored all of my suggestions on how to address the issue.
>
>
> My issue is not "how to workaround", but "how to predict that it may
> happen".

If you mean predict that it's going to happen before you see the error
for the first time, you basically can't. Even if it were in the docs,
the typical developer won't know that the limitation exists until
encountering it in the wild for the first time -- after all, the
limits are clearly documented for VS and C++ but most developers have
never heard of those either.

If you mean predict what code will trigger it once you know that it's
a problem, see Roberto's message. Once you're aware of the issue it's
fairly simple to restructure the code to fix it.

>> Visual
>> Studio imposes a 1MB limit on the size of a stack frame, and it's
>> entirely possible for automatically-generated code to hit this, and
>> the workaround if you don't want to change how your code works is to
>> increase that limit with a compiler option. As another example, the
>> C++ language specification provides a guideline of a limit of 256
>> levels of nesting and a limit of 1024 local variables.
>
>
> These examples are quite natural: 1MB stack, 256 levels, 1024 local
> variables.

There's nothing natural about those limits; they're just as arbitrary.
1024 locals in particular is ridiculously arbitrary -- what possible
low-level process could cause 1024 to be a relevant limit? 256 makes
sense that some ancient compilers would have stored the current depth
of the scope stack in a byte, but 1024 doesn't seem to correlate to
anything.

/s/ Adam