Added
Link Here
|
0 |
- |
1 |
--- base/allocator/partition_allocator/page_allocator_internals_posix.h.orig 2022-02-23 16:08:07 UTC |
|
|
2 |
+++ base/allocator/partition_allocator/page_allocator_internals_posix.h |
3 |
@@ -339,8 +339,12 @@ bool TryRecommitSystemPagesInternal( |
4 |
} |
5 |
|
6 |
void DiscardSystemPagesInternal(void* address, size_t length) { |
7 |
-#if defined(OS_APPLE) |
8 |
+#if defined(OS_APPLE) || defined(OS_BSD) |
9 |
+#if defined(OS_BSD) |
10 |
+ int ret = madvise(address, length, MADV_FREE); |
11 |
+#else |
12 |
int ret = madvise(address, length, MADV_FREE_REUSABLE); |
13 |
+#endif |
14 |
if (ret) { |
15 |
// MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED. |
16 |
ret = madvise(address, length, MADV_DONTNEED); |