Jump to content

world->Update() Crash


Go to solution Solved by aiaf,

Recommended Posts

Posted

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():

assert.thumb.jpg.370f5879443fbc9cd3cedc36bb17054e.jpg

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.

 

Posted

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.

  • Solution
Posted

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).

  • Upvote 1

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Posted

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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...