mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 06:16:30 +03:00
base/allocator: Fix recommitted pages not being zeroed when madvise is not available.
Support kernels built without CONFIG_ADVISE_SYSCALLS on small embedded devices.
This commit is contained in:
parent
81678a8f19
commit
1e83ca4c55
@ -261,6 +261,8 @@ constexpr PA_COMPONENT_EXPORT(
|
|||||||
PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
|
PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
|
||||||
#if BUILDFLAG(IS_APPLE)
|
#if BUILDFLAG(IS_APPLE)
|
||||||
return false;
|
return false;
|
||||||
|
#elif defined(NO_MADVISE_SYSCALL)
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -418,6 +418,9 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
|
|||||||
ret = madvise(ptr, length, MADV_DONTNEED);
|
ret = madvise(ptr, length, MADV_DONTNEED);
|
||||||
}
|
}
|
||||||
PA_PCHECK(ret == 0);
|
PA_PCHECK(ret == 0);
|
||||||
|
#elif defined(NO_MADVISE_SYSCALL)
|
||||||
|
static_cast<void>(ptr);
|
||||||
|
static_cast<void>(length);
|
||||||
#else // BUILDFLAG(IS_APPLE)
|
#else // BUILDFLAG(IS_APPLE)
|
||||||
// We have experimented with other flags, but with suboptimal results.
|
// We have experimented with other flags, but with suboptimal results.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user