So what can we learn from this.
First the most obviouse, is that the S va’se some bad value for MEM_RELEASE, as of the whys I’ve mentioned it aroud Departurs post sp I won’t repear it again.
BTW did I mention you can view values as hexdecimal in the debugger? Sorry if I didn’t, you can right click the value that pop up when you hover with the mouse over the variable, or in local varivles and select the hexdecimal view.
And the second conclusion is that you can call VirtualFreeEx with MEM_RELEASE after calling it with MEM_DECOMMIT but not after MEM_RELEASE.
You could also try calling MEM_DECOMMIT after MEM_RE:EASE and see you get the same result/
What does that mean? It means the pointer is still valid after decommit, but is invalid after it is releaced, hence your problem cannot be solved by using decommit. It may last longer because no physical pages are commited but the address space is reserved.
“Decommits the specified region of committed pages. After the operation, the pages are in the reserved state.”