Advertisement

My app randomly crashes!

Started by November 09, 2000 09:01 AM
9 comments, last by Yanroy 24 years, 1 month ago
Ok. So I have my map working fine. I can even display a grid over the tiles, and everything works great. Except that sometimes, about every third build, I click a menu option and the program bails out. Sometimes I even get into the main game, and I am happily scrolling around the map and I decide to test my PAUSE key... instant crash! I added a few WriteError() lines to see exactly where it was crashing. As soon as the WriteError() lines are in there, it doesn''t crash anymore! And the WriteError() function is as slow as molassas in January, so I lost about 20fps when I have it in. This problem is really bugging me (no pun intended, really!). I should let you know that I switch between different game states by setting my GameFunction function pointer to a different function. So the Menu function sets it to the PlayGame function which can either set it to the EndGame function or back to the menu function. Just thought that might have something to do with it. And I would like to stress that it only happens occasionally (sometimes I don''t even need to rebuilt, just rerun the EXE and it crashes, the next time it is as stable as... the opposite of Mac OS!). --------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

Try to get a demoversion of the program BoundsChecker ( www.numega.com ). It really helps finding suchs errors.
No, I''m not from numega. I use this program at work.

After the installation you''ve got a extra menu bar in der developer studio ( or c++ builder or Delphi ). So instead of compiling your program using Build\rebuild ( or Build\build ), you use BoundsChecker\rebuild ( or BoundsChecker\rebuild ). Run your game from the developer studio and a messagebox will pop up if BoundsChecker detects an error. Now click on debug and you''re in the line, where the error occurs. Trust me, it''s really that simple.
Advertisement
I checked out the info on the program. If it can really do all that reliably, I have to have it! I couldn''t find a price for it, do you happen to know how much it costs? More than likely it is out of my price range. How would I go about getting a demo version? I found no indication of a downloads section or a link to a demo in any of the info I read through.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

BoundsChecker really is very usefule for finding elusive bugs and memory leaks, as well as validating Windows API...you can even use it to validate your own API calls, with the proper modification. It costs $549 US for the Visual C++ version, although their salespeople will try to sell you up to the "subscription," which is $900 or something. I believe they also give student discounts. On their web site, there are a few links to order evaluation copies. You have to fill out his form, and then a salesperson from Compuware/Numega will call you. They''ll try to sell you their standard way of evaluation, which is to send you a full copy which you can send back after 30 days if you don''t like it. If you ask really, really nice though, then they''ll give you a password to a part of their web site where you can download 14 day evals of all their products (hafty downloads though, 14MB for BoundsChecker VC++ edition and 79MB for the full suite).

Liquid
$549 is just a *little* out of my price range. I was hoping for something that cost less than MSVC++ Kinda stupid to buy a compiler plugin that costs more than the compiler. Perhaps someone (or fate) will come up with a solution. As much as I would love to post my code, it would fill this forum thread several times over.

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

if the program is truely crashing and not exiting unexpectedly, have you tried to run it under debug?
cmaker- I do not make clones.
Advertisement
Are you using multiple threads? MFC?
Are you using the multithread safe dx libs?

A number of MFC objects will create bonus threads - when you exit, look at the bottom of the debug screen, and look for thread 0x.... terminated

If you have more than 1 thread, my money's on a race condition - which would explain why the writeerror() slowing it down changes its behavior.

Edited by - Magmai Kai Holmlor on November 9, 2000 6:59:12 PM
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
For these types of problems what you are looking for is memory problems. Maybe you are allocating memory that you are not freeing. When ever you see unpredictable crashes like that it is almost always a memory problem.

Welcome to my world, http://joware.cjb.net/
I hack code: passion is my feul. Use my programs, experience genius.
I am XiCI don't do talk, I code: passion is my feul. Use my programs, experience XiC. http://www.x-i-c.com/
My app use to do that, I found out is was because I was using the Incremental Link option in my makefile. For some reason, especially when I changed something like a #define in Winmain.h, the program would compile incorrectly somewhat, it would run, but intermittently strange things would happen, eventually resulting in a crash.

Instead of jumping into cool features like task pointers, program the ''basic code'' first, then do optimization later. My game went from virtually nothing to a fully-working-rock-solid game in a few months, even though I only have 2 levels and the game is slow on slow machines.

  Downloads:  ZeroOne Realm

I will look into the thread problem, but I am not creating any threads myself and I am not using MFC. How do I tell whether or not my dx libraries are multithread safe? I was eventually going to add a thread or two for AI and input.

JmarsKoder: I think I am freeing all my memory. The only things allocated dynamically are the DD objects (surfaces especially). I have a function that frees all my graphics, which is called in the function that frees DD (before it frees DD )

SikCiv: Who said anything about optimizations? I am using a function pointer because it is more flexible (I can make it point to anything I want to with the right prototype). Being a little bit faster is just a bonus. What are you suggesting I do instead? A switch statement seems to rigid (need to add new case statements to add new functions).

--------------------


You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming


You are unique. Just like everybody else.

Yanroy@usa.com

Visit the ROAD Programming Website for more programming help.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming
You are unique. Just like everybody else.
"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

This topic is closed to new replies.

Advertisement