Access Violation Error

Access Violation Error

I developed a database using AS400 components. Everything compiled and it was working for awhile. I have not changed anything in the project and now whenever I close the project or exit from it, I get an “Access Violation Error.” I can still run it and everything works fine but once I exit from the project it gives me that error and my computer locks up. I have to re-boot my computer because the error message says it’s still in debugging mode and I can’t do anything to get out of it. I don’t know what else to do. I’ve tried starting a new project by importing all the forms over and re-compiling it, but it still gives me the error when I try to exit from it.

There are a few things that contribute to this problem that you’re seeing. First, you need to look at open resources. Access violations occur because the program tries to read or write to an invalid memory location. If you’ve got pointers to objects, you should make sure you’re freeing them. If you’re using pointer variables at all, make sure you dispose of them, and for safety’s sake, set them to nil.

Another contributing factor is not related to Delphi so much as it is to any third party development libraries or components. With database applications, if the third party components interact at all with the BDE, you have to make sure they are compatible with the version of the BDE you’re using for your application. For instance, Crystal Reports components caused access violations to occur on exit when used with the BDE version 3.5. Apparently, it was some undocumented call in the BDE that was messing things up.

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide

Still another might have to do with the program trying to access resources that are no longer available. This is in a way related to the first point, but it might happen with remote database connections. You should check this.

In any case, here’s checklist you might want to follow:

  • Do I have the latest version of the BDE?
  • Is my third-party software (if any) installed correctly?
  • Am I properly disposing of instance variables?
  • Is my program attempting to access anything no longer available when it’s closing?

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist