Solved

Unexplained crashes

Posted on 2004-08-24
5
166 Views
Last Modified: 2010-04-07
I am writing a DirectDraw game. I had a few memory issues, which I seem to have fixed using windows task-manager to find where things were going wrong. After watching the app running for some time, the memory usage doesn't seem to change.

My problem is that when I run my game on another machine to my own, it runs fine for some time, but after a while just dies. Windows doesn't give me any error messages, and as I said the memory usage doesn't seem to change, so I have no clue as to what is going on.

Does anyone have any ideas as to what is going on, or what I could do to find out?

Thanks

phoenix260182
0
Comment
Question by:phoenix260182
  • 2
  • 2
5 Comments
 
LVL 8

Expert Comment

by:pjcrooks2000
Comment Utility
I take it tha your creating your game in C++, make sure you have created destructors for all your functions.

Otherwise you may be experiencing memory leaks and this will cause a crash.  

This may help you http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21010102.html

good luck pjcrooks2000
0
 

Author Comment

by:phoenix260182
Comment Utility
Okay, I am finally getting some error messages. One of them mentions something about a call to a function. The function's name has something to do with the heap pointer. Helpful at all?
0
 

Author Comment

by:phoenix260182
Comment Utility
Oh, and yes I'm using C++ in Visual Studio .NET 2003.
0
 
LVL 8

Expert Comment

by:pjcrooks2000
Comment Utility
Yes it does sound like a problem with a call to a destructor, heap = adding to stack.  Try running debug and see where the problem comes in at from the compiler.   Possibly the F5 key I am not sure but you can get to it through the menu anyway.

Step through the program and it should stop at the point where you program fails at.

I had something not too long ago with a Tile Map game I was making, I am not sure I can help you too much more on that unless you can copy and paste the offending code in here.  But run debug to find it, you never know it may be obvious to you once you get there.

Good luck with that :)
0
 
LVL 11

Accepted Solution

by:
bcladd earned 50 total points
Comment Utility
pheonix:

The heap is where dynamic memory is allocated (new in C++). It is not enough to have destructors for every object. You also have to make sure that your destructors release any resources held by the object in question (every new MUST be paired with a delete). You also have to make sure that you release any Direct* resources that you get (they are reference counted and until all refereces are released they are not cleaned up).

I agree that the debugger is your friend if you can reproduce the error. Is there anything you can do to make it happen faster on the other machine? What are the differences between the two configurations? If you can repro the bug on a development machine, then you can (hopefully) runn the program under the VS debugger and get a postmortem (it will show where the program was when it crashed). Unfortunately, it will, most likely, be right after a call to new that has nothing to do with the problem (it is just where the memory problem was detected).

Good luck,
-bcl
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now