Re: madvise(MADV_FREE) doesn't work in some cases?

From: Ka Ho Ng <>
Date: Tue, 13 Jul 2021 19:03:16 +0800
On 2021/7/6 3:47 AM, Vitaliy Gusev wrote:
>> On 5 Jul 2021, at 21:54, Konstantin Belousov <> wrote:
>> On Mon, Jul 05, 2021 at 07:32:00PM +0300, Vitaliy Gusev wrote:
>> DONTNEED does not allow system to free pages at all.  It means that pages
>> are less useful and can be paged out with higher priority.
> That caused behaviour that memory is not freed! 
> Is there a reason why FreeBSD behaviour for MADV_DONTNEED is different than in Linux and illumos ? Why it needs swap and cannot be easily dropped ?
Illumos has a similar behavior as FreeBSD in the way that it does not
destroy content of the underlying object. The operation you described in
Illumos is MAP_PURGE which is intended to be a bug-to-bug compatible
interface. See:
for full context.

Ka Ho
Received on Tue Jul 13 2021 - 11:03:16 UTC

Original text of this message