I get this occasionally when exiting my app - my app is running the EXE over a network. I understand it's a page fault when part of the EXE is loaded on demand.
I have also observed it in the OnDrawCell method of a TDrawGrid, so I'm mystified how that might have caused a page load. Also, the exception kept happening.
So my questions:
Can Error C0000006 result from other causes? I have made fairly major changes to the way the app manages memory, though nothing out of the ordinary, and I'm confident the code is behaving.
How can you make the app load all of itself into memory on startup (in Delphi 2006 - I understand there are directives for later versions of Delphi).
TIA
The directive $SetPEFlags
seems to be part of Delphi 2006, at least Hallvard talks about it in this article in the context of D2006. Have a look here on how to use it.
We experience this too. The system puts some of the executable pages out to swap and then fails to page it back some time later. It appears to be related to network connections being restored after sleep.
The only viable solution that we have found is to locate executables on the local machine.
This exception C0000006 also often occurs if your software is run from a network drive. To prevent that problem you can combine the flag
{$SetPEFlags IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP}
with the following flag:
IMAGE_FILE_NET_RUN_FROM_SWAP = $0800;
{$SetPEFlags $0C00}