There is really no answer. Under normal conditions, the OS will store something essentially in the entire system memory. Basically, as soon as he reads something in memory, he will keep a copy of it in memory until something else requires memory so that the first one is knocked out. There are a number of functions that can receive information about memory, but none of them even try to really return the amount of memory that is not fully used. The closest I know is GlobalMemoryStatusEx , which returns a number for the amount of available memory.
This means that there is currently both memory and disk in this memory, so a copy in memory can be erased without first having to write it to disk. For example, if you run the program, most of the code will remain in memory (for now, something else does not want memory) if you decide to run it again. Since this is just a copy of the program on disk, it can be discarded and (if necessary) reloaded from the disk, if necessary.
If you need more detailed information, you can use things like VirtualQueryEx to get it, but it usually overloads you with information about each block of memory used in this process, instead of giving a good, simple number saying "x bytes free".
source share