Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

helix

What did I do to break my game!?

This topic is 5732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know what I might have done to get the following behavior? ExhaustParticle* exp = new ExhaustParticle; exp->Spawn(); My game crashes because exp is NULL. ????? What could I have done to make new return NULL? My thought was that I have a huge memory leak that kills the heap but that seems unlikely as it happens while the game is still getting initialized. dammit.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
struct ExhaustParticle
{
...
ExhaustParticle()
{
blabla = x;
blibli = y;
}
};

ExhaustParticle *exp = new ExhaustParticle();

Share this post


Link to post
Share on other sites
new returning NULL should mean that you are out of heap space. Since that''s practically impossible as far as I know (since you would have no available virtual memory at all), is there anything between those two lines? Also, check Spawn(), and make sure it''s not doing anything wrong.

tj963

Share this post


Link to post
Share on other sites
You know, I think the problem is that my game is not thread safe. I''m having bogus crashes all over the place and this started happening after I made some changes to my client object to speed up the direct play message handler function. Could that cause wierd errors like this?

What a pain! I was hoping to avoid dealing with threads.

Share this post


Link to post
Share on other sites
Are you actually using multiple threads? If so, there''s no escape from thread synchronization. Use me!

Share this post


Link to post
Share on other sites
I''m not using threads but if I understand it correctly, DirectPlay does. The message handler callback function is run on a separate thread from the game. I put in some critical sections (like they do in the samples) but it still crashes at seemingly random places. I''m a networking newbie so I have no idea what I''m doing really. :D If I put a breakpoint or two in, there is no crash. WTF

I hate networking lol

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Are you sure it''s a sync problem? To me it sounds more like you have some heap corruption going on.

Running programs in release build, optimized for min-size, (with debugging symbols turned on) tends to be a good way of early make heap corruptions become visible. When you run in debug build there''s plenty of extra size laid out by the compiler/linker, that potentially can hide heap corruptions and then it''s much harder to find them.

Share this post


Link to post
Share on other sites
OK, I had a thought last night about this. I still had my project set to use Debug Singlethreaded but am using DirectPlay which is multithreaded. I switched it to Debug Multithreaded and it seems to run now. We''ll see if it stays like this...

Would that cause all the strange errors/crashes I was getting?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!