mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 17:17:19 +03:00
Fix potential VM map fragmentation regression.
Revert 245ae6036c (Support --with-lg-page
values larger than actual page size.), because it could cause VM map
fragmentation if the kernel grows mmap()ed memory downward.
This resolves #391.
This commit is contained in:
parent
48384dc2d8
commit
05a9e4ac65
3 changed files with 4 additions and 4 deletions
|
|
@ -754,7 +754,7 @@ sa2u(size_t size, size_t alignment)
|
|||
* Calculate the size of the over-size run that arena_palloc()
|
||||
* would need to allocate in order to guarantee the alignment.
|
||||
*/
|
||||
if (usize + large_pad + alignment <= arena_maxrun)
|
||||
if (usize + large_pad + alignment - PAGE <= arena_maxrun)
|
||||
return (usize);
|
||||
}
|
||||
|
||||
|
|
@ -784,7 +784,7 @@ sa2u(size_t size, size_t alignment)
|
|||
* Calculate the multi-chunk mapping that huge_palloc() would need in
|
||||
* order to guarantee the alignment.
|
||||
*/
|
||||
if (usize + alignment < usize) {
|
||||
if (usize + alignment - PAGE < usize) {
|
||||
/* size_t overflow. */
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue