Skip to content

POSIX osDecommitMemory has nasty compatibility problems

osDecommitMemory in rts/posix/OSMem.c currently does the following,

#ifdef MADV_FREE
    // Try MADV_FREE first, FreeBSD has both and MADV_DONTNEED
    // just swaps memory out
    r = madvise(at, size, MADV_FREE);
#else
    r = madvise(at, size, MADV_DONTNEED);
#endif
    if(r < 0)
        sysErrorBelch("unable to decommit memory");

As it turns out, the Linux kernel as of 4.5 supports MADV_FREE. This means that binary distributions built in such environments will use MADV_FREE, even if running on an older kernel that does not support this advice. Ultimately this means that any attempt to decommit will fail.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority high
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC simonmar
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information