GHC: internal error: getMBlock: mmap: Operation not permitted
Trying to calculate partition of a number using generating fuction with memoization, like this:
{{{ #!/usr/bin/runhaskell
part* :: Int -> Integer part* = ( map part' [0..] !!)
part' :: Int -> Integer part' 0 = 1 part' 1 = 1 part' n =
sum $ map (\k ->
let kk = fromInteger(k); k1 = floor(1/2*kk*(3*kk-1)); k2 = floor(1/2*kk*(3*kk+1)) in
(-1)^(k+1) * ( (part (n-k1)) + (part (n-k2))) ) [1..toInteger(n)]
part n =
if n < 0 then 0 else part'' n
main = print $ part 20000
}}}
Then i watch how memory usage grows up to 2G (RES) and program stops:
./bug.hs
bug.hs: internal error: getMBlock: mmap: Operation not permitted
(GHC version 7.4.1 for i386_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportab
The kernel is compiled with PAE, and machine has 8G of RAM
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |