Reputation: 3440
Say process 1 has allocated some space with VirtualAlloc in a function and the function already returned at that time. Is it possible that a second process frees the space with VirtualFreeEx if it knows the right address(es)?
Upvotes: 0
Views: 354
Reputation: 612963
The answer to this question is yes.
Memory is owned by the process in which it resides. It is not owned by the process which allocated it.
In many ways, this is similar to calling malloc
from one thread and then free
from another. That's perfectly fine. And it's perfectly fine to do the equivalent with VirtualAllocEx
and VirtualFreeEx
.
Upvotes: 6