SDL segmentation fault and image corruptions
Basically I have two problems. I'm currently developing a networked pong game using SDL and C with my class at college. It has the functionality to support up to 16 players in a single game, but issues are arising which causes the program to crash at random times and some images get messed up when new players join.
Okay first the program crashes randomly after like 5 minutes to 1 hour when SDL_UpperBlit is called like so: Code:
#define MAX_BLITS 34 Code:
if (ball.alive) { Anyways any suggestions towards either problem would help greatly. |
oowwe, my eyes.... sooo many hard coded numbers, and all packed together without comments... Not that it matters, doesn't seem to be anything interesting in that code anyways, nothing i can see to cause a error.
Have you tried just stepping thru program in a debugger like ddd? First, i would recommend a good pass thru valgrind, seems like a memory problem is a good place to start. |
I've just started running valgrind on it. From what it seems about 3/4 of the memory allocated is not being freed. The output of any real reference to the update_screen() function was:
Code:
==25943== 2,204 bytes in 1 blocks are still reachable in loss record 148 of 186 Code:
==25943== LEAK SUMMARY: |
Ummm, just to be clear, you recreated the error in valgrind? Because its nice to have memory friendly code and all, but using valgrind instead of a debugger is so its possible to see if memory is getting corrupted around the time of the error.
|
All times are GMT -5. The time now is 01:40 PM. |