Skip to content

Commit

Permalink
Avoid redundant GetVirtualMemoryLimit syscall (dotnet#95376)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Nov 29, 2023
1 parent c0dfcfd commit 0629552
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48097,7 +48097,8 @@ HRESULT GCHeap::Initialize()
// If no hard_limit is configured the reservation size is min of 1/2 GetVirtualMemoryLimit() or max of 256Gb or 2x physical limit.
gc_heap::regions_range = max((size_t)256 * 1024 * 1024 * 1024, (size_t)(2 * gc_heap::total_physical_mem));
}
gc_heap::regions_range = min(gc_heap::regions_range, GCToOSInterface::GetVirtualMemoryLimit()/2);
size_t virtual_mem_limit = GCToOSInterface::GetVirtualMemoryLimit();
gc_heap::regions_range = min(gc_heap::regions_range, virtual_mem_limit/2);
gc_heap::regions_range = align_on_page(gc_heap::regions_range);
}
GCConfig::SetGCRegionRange(gc_heap::regions_range);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ const AffinitySet* GCToOSInterface::SetGCThreadsAffinitySet(uintptr_t configAffi

#if HAVE_PROCFS_STATM
// Return the size of the user-mode portion of the virtual address space of this process.
size_t GetCurrentVirtualMemorySize()
static size_t GetCurrentVirtualMemorySize()
{
size_t result = (size_t)-1;
size_t linelen;
Expand Down

0 comments on commit 0629552

Please sign in to comment.