mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-09-16 03:04:48 +03:00
use physical memory in kib to avoid overflow of size_t (issue #1010)
This commit is contained in:
parent
78dd3f0e38
commit
ec4aa62b65
4 changed files with 18 additions and 18 deletions
|
@ -143,7 +143,7 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
|
|||
#if defined(_SC_PHYS_PAGES)
|
||||
long pphys = sysconf(_SC_PHYS_PAGES);
|
||||
if (pphys > 0 && (size_t)pphys < (SIZE_MAX/(size_t)psize)) {
|
||||
config->physical_memory = (size_t)pphys * (size_t)psize;
|
||||
config->physical_memory_in_kib = (size_t)pphys * ((size_t)psize / MI_KiB);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue