This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author StyXman
Recipients StyXman
Date 2016-03-21.10:51:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458557514.95.0.774301964914.issue26601@psf.upfronthosting.co.za>
In-reply-to
Content
Linux kernel's new madvise() MADV_FREE[1] could be used in the memory allocator to signal unused parts of the private heap as such, allowing the kernel use those pages for resolving lowmem pressure situations. From a LWN article[2]:

[...] Rather than reclaiming the pages immediately, this operation marks them for "lazy freeing" at some future point. Should the kernel run low on memory, these pages will be among the first reclaimed for other uses; should the application try to use such a page after it has been reclaimed, the kernel will give it a new, zero-filled page. But if memory is not tight, pages marked with MADV_FREE will remain in place; a future access to those pages will clear the "lazy free" bit and use the memory that was there before the MADV_FREE call. 

[...] MADV_FREE appears to be aimed at user-space memory allocator implementations. When an application frees a set of pages, the allocator will use an MADV_FREE call to tell the kernel that the contents of those pages no longer matter. Should the application quickly allocate more memory in the same address range, it will use the same pages, thus avoiding much of the overhead of freeing the old pages and allocating and zeroing the new ones. In short, MADV_FREE is meant as a way to say "I don't care about the data in this address range, but I may reuse the address range itself in the near future." 

Also note that this feature already exists in BSD kernels.

--
[1] http://kernelnewbies.org/Linux_4.5#head-42578a3e087d5bcc2940954a38ce794fe2cd642c

[2] https://lwn.net/Articles/590991/
History
Date User Action Args
2016-03-21 10:51:55StyXmansetrecipients: + StyXman
2016-03-21 10:51:54StyXmansetmessageid: <1458557514.95.0.774301964914.issue26601@psf.upfronthosting.co.za>
2016-03-21 10:51:54StyXmanlinkissue26601 messages
2016-03-21 10:51:54StyXmancreate