Fix VirtualLock on Windows

This commit is contained in:
Sebastian Messmer 2018-09-13 05:08:42 -07:00
parent 5ad55b1d58
commit 804dc89fb7
1 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ namespace cpputils {
void* UnswappableAllocator::allocate(size_t size) {
void* data = DefaultAllocator().allocate(size);
const BOOL result = ::VirtualLock(addr_, len_);
const BOOL result = ::VirtualLock(data, size);
if (!result) {
throw std::runtime_error("Error calling VirtualLock. Errno: " + std::to_string(GetLastError()));
}
@ -19,7 +19,7 @@ void* UnswappableAllocator::allocate(size_t size) {
}
void UnswappableAllocator::free(void* data, size_t size) {
const BOOL result = ::VirtualUnlock(addr_, len_);
const BOOL result = ::VirtualUnlock(data, size);
if (!result) {
LOG(WARN, "Error calling VirtualUnlock. Errno: {}", GetLastError());
}