small &^= 4096 - 1
}
if small < 4096 {
+ print("runtime: VirtualFree of ", small, " bytes failed with errno=", getlasterror(), "\n")
throw("runtime: failed to decommit pages")
}
v = add(v, small)
func sysUsed(v unsafe.Pointer, n uintptr) {
r := stdcall4(_VirtualAlloc, uintptr(v), n, _MEM_COMMIT, _PAGE_READWRITE)
if r != uintptr(v) {
+ print("runtime: VirtualAlloc of ", n, " bytes failed with errno=", getlasterror(), "\n")
throw("runtime: failed to commit pages")
}
small &^= 4096 - 1
}
if small < 4096 {
- throw("runtime: failed to decommit pages")
+ print("runtime: VirtualAlloc of ", small, " bytes failed with errno=", getlasterror(), "\n")
+ throw("runtime: failed to commit pages")
}
v = add(v, small)
n -= small
mSysStatDec(sysStat, n)
r := stdcall3(_VirtualFree, uintptr(v), 0, _MEM_RELEASE)
if r == 0 {
+ print("runtime: VirtualFree of ", n, " bytes failed with errno=", getlasterror(), "\n")
throw("runtime: failed to release pages")
}
}
mSysStatInc(sysStat, n)
p := stdcall4(_VirtualAlloc, uintptr(v), n, _MEM_COMMIT, _PAGE_READWRITE)
if p != uintptr(v) {
+ print("runtime: VirtualAlloc of ", n, " bytes failed with errno=", getlasterror(), "\n")
throw("runtime: cannot map pages in arena address space")
}
}