Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: EnterTheStory (aka tolworthy) on Tue 20/05/2008 08:36:32

Title: symbol table overflow
Post by: EnterTheStory (aka tolworthy) on Tue 20/05/2008 08:36:32
I just hit the error message "symbol table overflow" (using 2.72) and can't finsd any reference to it online. Any suggestions? I'm guessing that this is because I have a function that calls too many other funtions. Do I simply need to split the function in two, or is there another solution?
Title: Re: symbol table overflow
Post by: monkey0506 on Tue 20/05/2008 08:47:04
I believe the error for too many function calls is a call-stack error, not a symbol table overflow. You may be onto something different here.
Title: Re: symbol table overflow
Post by: EnterTheStory (aka tolworthy) on Tue 20/05/2008 09:21:14
Thanks. I wonder if I have too many strings? I tried splitting the big function into several parts, and got the same error message. The module contains seven thousand strings, and there are other modules of a similar size.

Before using AGS I used Sludge, and Sludge had a 65,500 String limit. So I wrote some code to compress entire conversations into a single string. It was ugly and awkward but it worked. Do you think I need to do the same with AGS? Or could there be some other problem at work here?
Title: Re: symbol table overflow
Post by: SSH on Tue 20/05/2008 13:19:28
I'd back-up your game, try importing it into AGS 3.01 and see if the problem still occurs there.
Title: Re: symbol table overflow
Post by: Radiant on Tue 20/05/2008 15:15:50
I think 2.72 should be able to handle that many strings (ATOTK uses plenty of them). What exactly are you doing with this many strings, and how are you generating them? It may be the case that your code has a memory leak.
Title: Re: symbol table overflow
Post by: EnterTheStory (aka tolworthy) on Tue 20/05/2008 16:38:13
Quote from: SSH on Tue 20/05/2008 13:19:28
I'd back-up your game, try importing it into AGS 3.01 and see if the problem still occurs there.
Do you mean for diagostics, or to stay with 3.01? I'm wedded to 2.72 for Linux purposes.

Quote from: Radiant on Tue 20/05/2008 15:15:50
What exactly are you doing with this many strings, and how are you generating them?
This module has most of the dialog in the game. This is a simplified version:

bool saidStuff;
function sayStuff(int who, int when, String what)
{ if((who ==you)&&(when ==now)) { character[who].say(what); saidStuff =true; }
// this also includes code for remembering what was said last, and next time you start looking from that point}
function checkDialog()
{saidStuff =false;
sayStuff(EGO, ANYTIME,"its a lovely day"); if(saidStuff)return;
sayStuff(EGOFRIEND,NIGHTTIME,"it's very dark"); if(saidStuff)return;
// etc., etc. 7,200 lines
}
Title: Re: symbol table overflow
Post by: SSH on Tue 20/05/2008 16:54:06
Diagnostics
Title: Re: symbol table overflow
Post by: Radiant on Tue 20/05/2008 17:10:55
Okay, looking over your code...

First, you should know that functions can return a value. So, an improvement would be


function sayStuff(int who, int when, String what)
{ if((who ==you)&&(when ==now)) { character[who].say(what); return true; }
...
  return false;
}


Second, I would suggest putting the relevant data in a struct array at initialization, and looking from there.


struct mydialog {
  int who, when;
  String what;
}


Both optimizations may make your code run smoother, and more importantly, avoid the problem. This is not guaranteed, but probably worth a try.
Title: Re: symbol table overflow
Post by: EnterTheStory (aka tolworthy) on Thu 22/05/2008 22:38:06
Update. I still don't know exactly what caused the problem (so I can't really mark this thread as solved). But I was short of time, so re-wrote the code to combine several short strings into one longer string. With a lower string count the "overflow" problem does not arise.
Title: Re: symbol table overflow
Post by: Pumaman on Sat 24/05/2008 12:08:28
The "symbol table overflow" can occur if you have a single very long script that reaches a certain size. This limit was increased for AGS 3.x, but if you want to continue with 2.72 then one workaround is to create a script module and move some of your code into that.

Although you've refactored your script to get rid of the error for now, it's likely to come back when you add more script. The overflow is related to the number of "symbols" (variables, strings, etc) that you have in a single script, and not directly related to the number of strings.