Well I found out by commenting out the function and making a new one. I copied just the declarations over and added a little debug line which would print something to my character if it worked. The mud hung again and then i started commenting out just individual declarations in it, i commented out skill_list, and what do you know? It worked. Also, it does have to do with memory, because it's an array. it makes 206 memory locations that are the size of MAX_STRING_LENGTH. So it does take up some memory and this was just my initial guess as to what it could possibly be. I have also run the mud using GDB and get this as i'm stepping though:

Program received signal EXC_BAD_ACCESS, Could not access memory.
0x00058b98 in do_skills (ch=0x592c68, argument=0x591c2b "") at skills.c:441
441             skill_list[level][0] = '\0';


On Thursday, December 20, 2001, at 04:26 PM, Jason Gauthier wrote:

How, pray tell, did you find out the exact line the mud's
hanging on? GDB's
good, but as far as I know it's not that good.. A backtrace
will get you
into the general area of where your mud went bad, but still.

Backtraces are good for core dumps, but not as useful when the mud is
actually running.
Since his mud is running he should step through it.

If you step through a program, and the program pauses on one line, GDB will
pause too.

What do levels have to do with memory? Umm, not much at all,
in fact I'd say
next to nothing.. I've increased ML quite a bit more than 206
and I get no
extra memory usage, etc... So, please, do elaborate as to how
you got to
this conclusion, because 10:1 it's wrong.

Well, he's not running out of memory, but in this case, his assumption that
MAX_LEVEL affects memory usage is correct.
He is creating an array based on MAX_LEVEL.
The size of the array, thus the amount of memory it uses, is determined by
MAX_LEVEL.

char skill_list[LEVEL_HERO][MAX_STRING_LENGTH];

If MAX_LEVEL is 412 it takes up exactly twice as much memory as if it was
206.


I would highly recommend tracing the program with GDB to find out where your
'hang' is.

--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom


Reply via email to