symbol table overflow

Started by EnterTheStory (aka tolworthy), Tue 20/05/2008 08:36:32

Previous topic - Next topic

EnterTheStory (aka tolworthy)

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?

monkey0506

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.

EnterTheStory (aka tolworthy)

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?

SSH

I'd back-up your game, try importing it into AGS 3.01 and see if the problem still occurs there.
12

Radiant

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.

EnterTheStory (aka tolworthy)

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:
Code: ags

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
}

SSH

12

Radiant

Okay, looking over your code...

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

Code: ags

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.

Code: ags

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.

EnterTheStory (aka tolworthy)

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.

Pumaman

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.

SMF spam blocked by CleanTalk