PDA

View Full Version : Weird Acces violation when closing the application



chronozphere
11-12-2007, 07:38 PM
OS: Vista Ultimate
IDE: Delphi 7
API: n.a

Hi everyone. :)

I got this weird problem. Sometimes when i close my application (my WIP), the CPU window pops up, and an AV is shown. The adresses shown in the AV are alway's one of 3 or 4 different adresses. The place where it happens in the source also differs. I don't know any source adresses that are shown in the CPU window. I think it crashes somewhere in an unknown DLL. I see some "RTL" routines in the dissasembled lines of code.

This doesn't seem to happen on my laptop which runs on XP pro. :?

Any idea's where this might come from, and how to get rid of it? Should i worry about this, or is it probably a driver or OS bug etc...

Any usefull replies would be highly appreciated. ;)

Robert Kosek
11-12-2007, 08:31 PM
A few things to think about.

1) Double check all free operations. Freeing pointers, clearing arrays, and nullifying certain types in slightly wrong ways can make big errors on exit.

2) Ensure that you are actually not freeing things in the improper order. For example Zlib is dependent upon a child stream that you pass it to decompress from, or compress to. If you free the wrong one first then you can have errors while freeing the other.

3) Lost surfaces/canvases. Timed operations and such that hit a losable canvas or surface can cause these, but a simple "timer.enabled := false" at the beginning of your close/destroy event can prevent it.

I know they're all elementary things you've probably thought of, but they are the most common, simplistic, mistakes that you can make. Many times I've shot myself in the foot like this. Maybe if you show the close/destroy event that is called when you close the application I could help, but without source I can't do more than this. :)

Mirage
12-12-2007, 08:11 AM
chronozphere, use FastMM with its debugging features turned on. It reports all invalid FreeMem calls etc.

chronozphere
12-12-2007, 11:47 AM
AFAIK, my program free's all data it uses. If that was the problem, i probably would get it EVERY time i ran the app, and it would show me a good usefull source-line, where the AV occured, I think. :?

I have downloaded FastMM, but i dont know how to use it to diagnose this problem.

Can someone provide me with a list of things i have to do, to find the source of this AV?

Thanx alot! :)