got internal error when running a simple but computationally intensive loop
Got the following on the GHCi prompt:
λ> main
<interactive>: internal error: Unable to commit 1048576 bytes of memory
(GHC version 8.2.2 for x86_64_unknown_linux)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Aborted (core dumped)
The program being run:
gaussian mean sigma x =
exp (-0.5 * (x - mean) ^ 2 / sigma ^ 2) / (sigma * sqrt (2 * pi))
integrate :: (Double -> Double) -> (Double, Double) -> Double -> Double
integrate f (low, high) step = step * sum values
where xs = [low, low+step .. high]
values = f <$> xs
main = print $ integrate (gaussian 100 10) (-1 * 1e5, 1e5) 0.001
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |