
#12865: POSIX osDecommitMemory has nasty compatibility problems ----------------------------------------+--------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Runtime System | Version: 8.0.1 Keywords: | Operating System: Linux Architecture: Unknown/Multiple | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: ----------------------------------------+--------------------------------- `osDecommitMemory` in `rts/posix/OSMem.c` currently does the following, {{{#!c #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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12865 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler