
#13112: Windows 64-bit GHC HEAD segfaults on the code with a lot of TH stuff. ---------------------------------+-------------------------------------- Reporter: awson | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by awson): I've managed to create quick and dirty solution to make GHC work properly (basically we have to add `MEM_TOP_DOWN` flag to `VirtualAlloc` in our main `allocNew` allocation routine (see `OSMem.c`). In such a way we allocate all memory except executable (which uses `allocateExec` and `allocateImageAndTrampolines` allocation routines) from top to down leaving enough room for executable memory in low address area. OTOH, while this solves the problem for GHC itself, it can create problems for programs linked against such modified RTS: 1. MS warns that allocation from top to down may be slower; 2. If a client makes its own dynamic data execution using these data, its code will likely crash. Thus if we ever would go this way, we should modify the build system, using different allocation strategies for GHC itself and for RTS libraries distributed along with GHC. I have another couple of patches, which may or may not improve Windows allocation matters in RTS. E.g. `HeapAlloc` works well for `allocateImageAndTrampolines` saving quite a lot of memory comparing to the quite wasteful `VirtualAlloc`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13112#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler