Index: base/memory/discardable_shared_memory.cc |
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc |
index c04e5c41c58d0b7945afcafb25e7d5cd3b5aee05..99d2991308a3cd503543f5c6da2cbcc6ef1765e1 100644 |
--- a/base/memory/discardable_shared_memory.cc |
+++ b/base/memory/discardable_shared_memory.cc |
@@ -344,6 +344,11 @@ bool DiscardableSharedMemory::Purge(Time current_time) { |
// provide MADV_FREE which has the same result but memory is purged lazily. |
#if defined(OS_LINUX) || defined(OS_ANDROID) |
#define MADV_PURGE_ARGUMENT MADV_REMOVE |
+#elif defined(OS_MACOSX) |
+// MADV_FREE_REUSABLE is similar to MADV_FREE, but also marks the pages with the |
+// reusable bit, which allows both Activity Monitor and memory-infra to |
+// correctly track the pages. |
+#define MADV_PURGE_ARGUMENT MADV_FREE_REUSABLE |
#else |
#define MADV_PURGE_ARGUMENT MADV_FREE |
#endif |