Avatar of Intersection
 asked on

File.Copy() many times results in "System PTE" depletion and evenutally system crash

Hello Experts!

Im working on a VB.net file management program that copies 100,000s of small images (20 - 300 KB).
At least it tries to. When doing large multi-hour operations I start getting exceptions with the
"Insufficient system resources exist to complete the requested service." error message.
In a few cases the computer has then crashed.
After a lot of debugging, finally with livekd kernal dump I can see that the System PTEs in the Kernel Mem are getting very low.. enough that kd had a message "******** running out of system PTEs *********"

Now I can monitor the PTE's in realtime with Performance Monitor with the Memory/Free System Page Table Entries.

I observe that after an hour or so the PTE's start dropping in what appears to be linear fashion as the program keeps copying.
Im sure it is the copy function causing the problem, because when i comment out the copy routine, the free PTEs stopped going down.

Behaviour is identical with both of these calls.
System.IO.File.Copy(strFileSource, strFileDest, bOverwriteFile)
My.Computer.FileSystem.CopyFile(strFileSource, strFileDest, bOverwriteFile)

If I stop & close the program, PTEs do not seem to rebound at all. If I start the program again, the PTEs again start going down.

SO: What is up with File.Copy? Why is it using and not releasing all these PTE's? Seems this memory should be free after the copy.
How can I change my code to avoid running up the PTEs?

Thank you for any ideas, advice, assistance!

NOTE: That I asked this question before, but Ive learned enough about the problem that I decided to repost:

The test computer is Windows XP sp2 with 500MB ram. (also been testing with 1.5 G ram)

Ive found some helpful documents on PTEs, which discuss system configuration. But this is not really an option for me as this is a commercial product that others will be using on their own computers.

Detection, Analysis, and Corrective Actions for Low Page Table Entries.

Windows XPVisual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.