summaryrefslogtreecommitdiff
path: root/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
diff options
context:
space:
mode:
Diffstat (limited to 'www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h')
-rw-r--r--www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h b/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
new file mode 100644
index 000000000000..7e52a7b9473f
--- /dev/null
+++ b/www/ungoogled-chromium/files/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
@@ -0,0 +1,16 @@
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h.orig 2023-12-23 12:33:28 UTC
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
+@@ -403,8 +403,12 @@ bool TryRecommitSystemPagesInternal(
+
+ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
+ void* ptr = reinterpret_cast<void*>(address);
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
++#if BUILDFLAG(IS_BSD)
++ int ret = madvise(ptr, length, MADV_FREE);
++#else
+ int ret = madvise(ptr, length, MADV_FREE_REUSABLE);
++#endif
+ if (ret) {
+ // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED.
+ ret = madvise(ptr, length, MADV_DONTNEED);