I know there is a limit of how many variables I can have in an array.
But is there a limit to how many variables I can have defined at the same time?
Question
Moderator: Moderators
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Question
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
No reason actually, I was just wondering, I'm making lots of scripts (for my server) and I don't want to suddenly come to such an error.
EDIT: Ah I think I found the size. Someone had a problem with having too many entries in his array at tmt:
I think the "1" in the first number is a typo (as is the case with many errors in mohaa). So I assume it's 5226 for the number of variables and 1024 per variable (= array). I think I won't ever have to worry about that then. 
EDIT: Ah I think I found the size. Someone had a problem with having too many entries in his array at tmt:
Code: Select all
The required variable stack size of 15226 exceeds the statically allocated variable stack of size 1024.
Increase SCRIPTTHREAD_VARSTACK_SIZE to at least 5226 and recompile.Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
I think you misinterpreted the message a bit. This 5226 (or 15226, I wouldn't be so sure as to which one here is a typo) is actually the number of variables that the scripter put in his script, not a limit of the scripting engine. The developers were just trying to be make the message more meaningful to themselves during any debugging they might be doing by including that number.
Guessing by the constant name (SCRIPTTHREAD_VARSTACK_SIZE), I'd say that they implemented the scripting engine using a per-thread stack system with a fixed size of 4kB (1024 * 4 bytes; I bet that the stack is 32-bit and holds either integers, floats or pointers) per thread, regardless of the type of variables and their organization (i.e. 2 integer variables and a 2-element integer array both take up the same amount of space on the stack).
By the way, it's funny how all programmers have a habit of rounding constants to the nearest power of 2. I do it too.
Guessing by the constant name (SCRIPTTHREAD_VARSTACK_SIZE), I'd say that they implemented the scripting engine using a per-thread stack system with a fixed size of 4kB (1024 * 4 bytes; I bet that the stack is 32-bit and holds either integers, floats or pointers) per thread, regardless of the type of variables and their organization (i.e. 2 integer variables and a 2-element integer array both take up the same amount of space on the stack).
By the way, it's funny how all programmers have a habit of rounding constants to the nearest power of 2. I do it too.
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Hmm, I see so if I understand correctly, it's quite impossible to "run out of" vars. 4 kb per thread is a lot!
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:

