1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Your application will be shut down!
Page 1 : What access violations are and how to prevent AVs at design-time.
 More of this Feature
• Page 2: Run-time AVs
 Join the Discussion
"Post your questions, concerns, views and comments to this article..."
 Related Resources
• Delphi IDE articles
• Handling exceptions
 Elsewhere on the Web
• AVs to PAS line numbers
• Clean Up After Yourself!
• Dr. Watson
• How to read the 'BSOD'
• GPF solve flowchart
• Troubleshooting Common Problems with Applications

Access Violation, General Protection Fault or Invalid Page Fault, the name changes, but the nature of the error is always the same. Access Violation is a phrase that users of personal computers see when an application they are running tries to access storage that is not designated for their use - and crashes.

Access violation at address
in module .
Read of address

If Windows applications were able to write outside of its assigned storage area, it could overwrite other applications' or the operating system's instructions and data. If that should happen, the operating system would "crash" or close down in some way and you would have to reboot the operating system. For example, when a program error occurs in Windows NT/2000, Dr. Watson steps in and stops the program, taking some quick diagnostic stats, recording them in a text file.

Access Violations are some of the most frustrating errors encountered in Windows programming. The purpose of this article is to help you find the solution to your AVs with Delphi. To start with, access violations have nothing to do with Microsoft Access.

We can divide AVs encountered while developing with Delphi in two major types: runtime and design time.

   Access Violations at Design-Time
Design time AVs are experienced when starting and closing the Delphi IDE or building a Delphi project.

AV messages that crop up while your computer is in operation can be generated by various different sources, including the system BIOS, the operating system or hardware driver routines. Some video, sound or network cards can actually cause AVs in Delphi. Why? Every card in your machine comes with device drivers. Depending on the manufacturer, the version of Windows, and the version of Delphi used you may experience problems. There are some steps that can be taken to help resolve these issues:

  • Take the steps necessary to verify that there are no conflicts between your installed devices.
  • Sometimes lowering the resolution will help stabilize a quirky video card driver.
  • Insure that if you are using a dual processor motherboard that the step revision for each processor is the same.
  • Always use the latest driver for all of the components in your system.

    Although Windows is the most popular operating system for Intel machines, due to the extreme fragility and bugginess of Windows, misbehaving applications can readily crash the OS (and the OS sometimes crashes itself spontaneously). There are ways that you can help your chances of having a more stable programming environment, which in turn will help to prevent certain AVs.

  • Although Windows 9X is quite popular, Windows NT/2000 has proven to be a much more stable environment for almost all Windows coding platforms.
  • Ensure that you have installed the latest service packs for NT/2000. With each service pack released, you will find that your machine will become more stable.
  • One excellent method of proactive error prevention is to always keep the current with all updates and patches for whatever edition and version of Delphi (BDE, ADO, ...) that you are using. Always have the latest patch for Delphi - the number of AVs, especially design time violations, will drastically decrease.
  • If you are getting random access violations in the IDE, you have most likely installed a bad component or package or a wizard that was not written/compiled for your Delphi version. Try uninstalling custom components one by one (or package by package) until the problem goes away, then get in touch with the component vendor regarding this issue.
  • Check to see whether if there is anything unusual installed on the machine with the program that crashes. Curious shareware utilities and beta products are AV favorites.
  • An access violation can also occur because a system setting is wrong. If you repeatedly encounter the same error message, record the details and call the company that makes the software that seems to be causing the message.

    That is all I can suggest for design-time access violations, the rest of the article deals with run-time AVs and how to make sure your application will not cause them!

    Next page > Preventing run-time AVs > Page 1, 2

  • ©2017 About.com. All rights reserved.