четверг, 2 декабря 2010 г., 2:50:13 UTC+7 пользователь RossettoeCioccolato написал:
I had the same problem - if I make many calls MapViewOfFile + FlushViewOfFile + UnmapViewOfFile physical memory runs out, process virtual memory also runs out an application crashed. Pseudocode is very simple:
CreateFile
CreateFileMapping 8Gb // your machine physical memory size here
for(i = 0; i < 8 * 1024; ++i)
{
MapViewOfFile 1Mb
// here some changes in memory for it need to be saved to hdd
Sleep 5000 // application not trying to eat all memory, it just working
FlushViewOfFile
UnmapViewOfFile
}
CloseHandle Map
CloseHandle File
So the question is: how to make Windows release unmapped pages?