NO

Author Topic: Crashing 3D program (GPS)  (Read 3110 times)

allan.emren

  • Guest
Crashing 3D program (GPS)
« on: April 08, 2011, 09:27:10 PM »
Hello,
I am developing a GPS-synthetic vision program for pocket PC.

Every two seconds, the screen is erased and a new picture is drawn.

My problem is that within five minutes, the graphics stops functioning. The picture becomes black-white, and all graphics disappears. Sometimes, text continues to work normal. Sometimes, the program crashes entirely.

My first thought was that some variable dimension was too small. This has turned out not to be the case.

I also took steps to make sure that I stay within array boundaries, and that nothing is drawn outside the screen.

The largest array used contains terrain data (global array). All arrays are loaded once, during initiation.

One possibility could be stack overflow. Is there a way to check for that error, and hopefully, to flush the stack?


Trying to solve the problem, I have made a simulated version for PC. There is no GPS-signal involved. This one is simulated as well. The program behaves similarly there. The program crash does not occur at any specified time, neither in PC or pocket-PC, but typically within the time interval mentioned above.

In the attachment, source code, data files and exe-file are supplied in a zipped directory.

I also have removed most detailed landscape pictures. The exception is that lakes are indicated by blue lines.

I attach the program including executable and source, as well as data files used by the program.

To see the problem, run the file Simulator-PC.exe
At the top of the screen, you will see blue sky. At the bottom, there is an aircraft symbol (cross). Below that, there are two buttons, < and >. Clicking them will turn the aircraft a couple of degrees each time.

Try flying approximately via Hemsjo, ESIB and ESGO. The program is expected to crash before you reach ESIB. By then, several ten thousands of lines have been drawn.

My conclusion is that there is a bug that makes memory leak, or that some graphic function does not restore used memory properly.

In my code, all graphics is handled in the file allan.c
All calculations are performed in the file gps.c, and interrups as well as setup and quit are handled in main.c

Stopping and restarting the program, works, but causes too much delays, as lots of data have to be loaded.

If no one has an idea on causes, is there a way to flush the memory while the program is running. In other words, make the program window close itself an reopen while variables remain intact?

Also, is there a way for the program to see that it is about to crash?

Thanks,

Allan


allan.emren

  • Guest
Re: Crashing 3D program (GPS)
« Reply #1 on: April 11, 2011, 01:55:38 PM »
Problem solved, thanks to helpful people in the forum.
See: http://forum.pellesc.de/index.php?topic=3247.0

Allan