Skip to content

Commit 35c1d59

Browse files
brad0gitster
authored andcommitted
builtin/gc: correct physical memory detection for OpenBSD / NetBSD
OpenBSD / NetBSD use HW_PHYSMEM64 to detect the amount of physical memory in a system. HW_PHYSMEM will not provide the correct amount on a system with >=4GB of memory. Signed-off-by: Brad Smith <[email protected]> Reviewed-by: Collin Funk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7014b55 commit 35c1d59

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

builtin/gc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,16 @@ static uint64_t total_ram(void)
516516
total *= (uint64_t)si.mem_unit;
517517
return total;
518518
}
519-
#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM))
519+
#elif defined(HAVE_BSD_SYSCTL) && (defined(HW_MEMSIZE) || defined(HW_PHYSMEM) || defined(HW_PHYSMEM64))
520520
int64_t physical_memory;
521521
int mib[2];
522522
size_t length;
523523

524524
mib[0] = CTL_HW;
525525
# if defined(HW_MEMSIZE)
526526
mib[1] = HW_MEMSIZE;
527+
# elif defined(HW_PHYSMEM64)
528+
mib[1] = HW_PHYSMEM64;
527529
# else
528530
mib[1] = HW_PHYSMEM;
529531
# endif

0 commit comments

Comments
 (0)