Fix VirtualLock on Windows
This commit is contained in:
parent
5ad55b1d58
commit
804dc89fb7
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user