I know this is a longshot and unfortunately I cant provide too much information but in the past the people of this board have helped me out so I hoping maybe someone could give me some advice.
I managed to write my mud which I had posted about before, its not the most efficent mud in the world but it works which is the main thing for me at the moment. I shall improve it later on but right now im experiencing a bug which is driving me nuts and I cant figure out where its going wrong.
im getting alot of these segfaults.. (running with gdb)
Program received signal SIGSEGV, Segmentation fault.
chunk_alloc (ar_ptr=0x4018e300, nb=1065) at malloc.c:2990
2990 malloc.c: No such file or directory.
now i backtrace them and its always in different functions, etc. Completely random, Also the timing is always random aswell it could run for a while and be fine, then after a while just crash with chunk_alloc errors when a different event occurs.
Now ive searched on google for this but all i can find is pages with people dumping gdb output so im not 100% of what this error is. Im making a logical guess that in trying to allocate some memory for something its either overwriting or running out of ? Im sure its not running out of memory though as a ps -aux never see it rise above 0.9% mem usage.
Now im running a fair few MySQL queries when people do things like /look etc and I think that maybe where my problems lye because im giving my query strings huge junks of memory like query=malloc(3096); as for a while I thought i wasnt allocating enough memory to the query strings, anyway that doesnt seem to have fixed the problems. Although could this be where my problems are ? the allocating too much memory for queries ?
My MUD loops every second and ive built a linked list of events which the program will loop through to see if anything needs to occur. Ive double checked these functions and they all seem fine but what Im asking is, if a program is structured badly can they result in memory corruption i.e the chunk_alloc errors ? or would it just run slower but get there in the end.
So i ask you guys if there is anyway I can try and track down where my program is going wrong, maybe some kind of memory monitor (running on linux btw) in determining if pointers are being overwritten ? I try to display as much information as possible in debug so as soon as an event occurs and it has to come out of the linked list (or go in)I display everything in the list so I can see the next pointer address, previous, etc. and its not looking like its corrupting anywhere.
Well there ya have it, I know i havent provided too much information but im really at a loss here, just when I think I have found a problem, i fix it, it runs great for 2 / 3 hours and then bam chunk_alloc message appears in gdb
thanks in advance to anyone who can provide even the smallest clue