diff options
-rw-r--r-- | Doc/library/mmap.rst | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst | 1 | ||||
-rw-r--r-- | Modules/mmapmodule.c | 8 |
3 files changed, 11 insertions, 0 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 698c176..d9825b4 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -337,6 +337,8 @@ MADV_* Constants MADV_NOCORE MADV_CORE MADV_PROTECT + MADV_FREE_REUSABLE + MADV_FREE_REUSE These options can be passed to :meth:`mmap.madvise`. Not every option will be present on every system. diff --git a/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst b/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst new file mode 100644 index 0000000..d431a9d --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2020-11-01-15-10-28.bpo-42232.2zI1GN.rst @@ -0,0 +1 @@ +Added Darwin specific madvise options to mmap module.
\ No newline at end of file diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 1e96849..1e66962 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1667,6 +1667,14 @@ mmap_exec(PyObject *module) #ifdef MADV_PROTECT ADD_INT_MACRO(module, MADV_PROTECT); #endif + + // Darwin-specific +#ifdef MADV_FREE_REUSABLE // (As MADV_FREE but reclaims more faithful for task_info/Activity Monitor...) + ADD_INT_MACRO(module, MADV_FREE_REUSABLE); +#endif +#ifdef MADV_FREE_REUSE // (Reuse pages previously tagged as reusable) + ADD_INT_MACRO(module, MADV_FREE_REUSE); +#endif #endif // HAVE_MADVISE return 0; } |