[GHC] #12865: POSIX osDecommitMemory has nasty compatibility problems

GHC ghc-devs at haskell.org
Mon Nov 21 23:21:35 UTC 2016


#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
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 One approach to fixing this would be to instead do something like this,
 {{{#!c
     int r = 1;
 #ifdef MADV_FREE
     // Try MADV_FREE first, FreeBSD has both and MADV_DONTNEED
     // just swaps memory out
     r = madvise(at, size, MADV_FREE);
 #endif
 #ifdef MADV_DONTNEED
     if (r != 0)
         r = madvise(at, size, MADV_DONTNEED);
 #endif
     if(r < 0)
         sysErrorBelch("unable to decommit memory");
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12865#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list