mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge bitcoin/bitcoin#25320: util: modify Win32LockedPageAllocator to query windows for limit.
1cb42aeda3
util: modify Win32LockedPageAllocator to query windows for limit (Oskar Mendel) Pull request description: This PR resolves a todo within the Win32LockedPageAllocator: `// TODO is there a limit on Windows, how to get it?`. The idea is to use the Windows API to get the limits like the posix based allocator does with `getrlimit`. I use [GetProcessWorkingSetSize](https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-getprocessworkingsetsize) to perform this task and fallback to `return std::numeric_limits<size_t>::max();` just like the posix implementation does. ACKs for top commit: sipsorcery: tACK1cb42aeda3
. Tree-SHA512: 7bdd8a57a4e64ee59d752417a519656e03526878462060753be4dce481eff4889fb5edc1bdbd575b707d9b2dfe255c87da9ef67baac97de9ac5e70a04c852081
This commit is contained in:
commit
c5fbcf5f8d
1 changed files with 4 additions and 1 deletions
|
@ -202,7 +202,10 @@ void Win32LockedPageAllocator::FreeLocked(void* addr, size_t len)
|
||||||
|
|
||||||
size_t Win32LockedPageAllocator::GetLimit()
|
size_t Win32LockedPageAllocator::GetLimit()
|
||||||
{
|
{
|
||||||
// TODO is there a limit on Windows, how to get it?
|
size_t min, max;
|
||||||
|
if(GetProcessWorkingSetSize(GetCurrentProcess(), &min, &max) != 0) {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
return std::numeric_limits<size_t>::max();
|
return std::numeric_limits<size_t>::max();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue