Lately I'm using imdisk http://www.ltr-data.se/opencode.html/#ImDisk I am making a 1 GB ramdisk with this command: imdisk.exe -a -t vm -m V: -s 1024M -p "/fs:NTFS /q /y /v:Name /c" I want to know how much physical Ram takes this ramdisk. But it seems that it depends on how the ramdisk is filled with files. It starts with a few MB then it increases with each file I copy. If I then remove those files, the amount of physical Ram that it takes doesn't decrease. So I can't use GetDiskFreeSpaceEx to get the amount of physical Ram because it will not show correctly. Also I can't see the programs's driver as a normal program so I could measure its size.
I talked to the author and he says:
Okay, you were talking about physical memory. I was talking about kernel address space. ImDisk allocates all memory at once in one single address block for ram disks so there is no dynamic allocation or anything like that.
I would think that the only way to determine how much physical memory this address space uses at one particular moment would be if there is some undocumented API that reports commit/physical values for a particular memory block. I don't know of any such API however.
But maybe someone knows a way... I mean to get that number in a program, not just visually.