Getting External Exception C0000006 in D2006 app - how can I force delphi to load the whole executable?

 ̄綄美尐妖づ 提交于 2020-01-11 06:45:13

问题


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


回答1:


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.




回答2:


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.




回答3:


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}


来源:https://stackoverflow.com/questions/6905395/getting-external-exception-c0000006-in-d2006-app-how-can-i-force-delphi-to-loa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!