I am trying to write a program that does some reading/processing/writing.
While everything works fine when I give my program a local path, I am faced with an unusual problem: huge memory usage when I process files over the local area network.
If the file path is something like "//network_address/folder/*.ext
" the program uses about 4G RAM (as opposed to 500 - 1G when the path is something like "c:/folder/*.ext
")
I used Process Monitor to see what is going on and noticed consistent read failures in the "c:\windows\csc\v2.0.6\namespace
" folder - which I hadn't even known existed. Researching it, I found that it was used to sync files with a network server, perhaps to view network files offline.
The above failures were happening exactly before a write to file process started (not before reads), the namespace folder did not get used, I had nothing synced, and the actual writes to the network drives were successful.
I haven't set up any option to sync folders... (and I don't want to)
As soon as I took ownership of that folder, the memory usage went down (though I still got read errors in Process Monitor).
So... I think my problem is I have been trying to do something I am not allowed to, and using a lot of memory to hold data while I am trying to do what I am not allowed, until I fail and finally put the data where it belongs...
The solution: avoid doing things that I am not allowed to do, right ?
Is there a way (preferably a command line that I can run in my code, or a registry entry I can modify) that can prevent my program from syncing files (if that is what is happening) or using that namespace folder when reading off a network drive ?
How can I prevent Windows from syncing files behind my back, and just writing files directly to the network folder ?