gamecreator Posted December 8, 2018 Share Posted December 8, 2018 What things could potentially make world->Update() crash a program? I have the following code right now and the program regularly crashes after printing D and not printing E to the console. printf("C"); Leadwerks::Time::Update(); printf("D"); world->Update(); printf("E"); world->Render(); printf("F"); gui.draw(); printf("G"); context->Sync(true); printf("H"); As I was typing this up and testing the program again, I got the following error, which seems like it crashed during world->Render(): Searching the forums found this issue (https://www.leadwerks.com/community/topic/10612-world-update-crash/) which seemed to be resolved at the time. I should also make it clear that this doesn't usually happen as soon as I start the game. Sometimes it takes a few seconds, sometimes it's when I fire a shot, sometimes when I kill an enemy. Happens sooner the more enemies I include though. Pretty much never happens with just a few, like 6 or less. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted December 8, 2018 Author Share Posted December 8, 2018 It does also crash on exit now for some reason. Double-checking to make sure nothing is out of bounds or a memory leak. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted December 8, 2018 Author Share Posted December 8, 2018 I think I might have caught the problem. Of course it was on my end, even though it seemed to crash in a Leadwerks function. I was using a char for an offset and when I introduced more enemies, I think that overflowed. Setting it to an int seemed to fix it. Quote Link to comment Share on other sites More sharing options...
Solution aiaf Posted December 8, 2018 Solution Share Posted December 8, 2018 Running under debugger something helps identify problems. But the ultimate tool for this is in the linux land its valgrind detects memory leaks and other kind of memory stuff. To tell the true there are for windows also Dr Memory(free but never used it) and purify (this one is expensive). 1 Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
gamecreator Posted December 8, 2018 Author Share Posted December 8, 2018 Yes, the debugger ended up helping me. I pretty much never use it and am not really familiar with it. It pointed to a free() function which helped me figure out that I was handling my memory incorrectly. Thanks for the other suggestions too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.