Commit 9b283e1b authored by Roland Senn's avatar Roland Senn Committed by Marge Bot

Initialize the allocation counter in GHCi to 0 (Fixes #16012)

According to the documentation for the function `getAllocationCounter` in
[System.Mem](http://hackage.haskell.org/package/base-4.14.0.0/docs/System-Mem.html)
initialize the allocationCounter also in GHCi to 0.
parent 32fd37f5
......@@ -250,10 +250,10 @@ redirectInterrupts target wait = do
measureAlloc :: IO (EvalResult a) -> IO (EvalStatus a)
measureAlloc io = do
setAllocationCounter maxBound
setAllocationCounter 0 -- #16012
a <- io
ctr <- getAllocationCounter
let allocs = fromIntegral (maxBound::Int64) - fromIntegral ctr
let allocs = negate $ fromIntegral ctr
return (EvalComplete allocs a)
-- Exceptions can't be marshaled because they're dynamically typed, so
......
n <- System.Mem.getAllocationCounter
(n < 0 && n >= -160000)
......@@ -62,6 +62,7 @@ test('T15633b',
],
ghci_script, ['T15633b.script'])
test('T16012', just_ghci, ghci_script, ['T16012.script'])
test('T16096', just_ghci, ghci_script, ['T16096.script'])
test('T507', just_ghci, ghci_script, ['T507.script'])
test('T18027', just_ghci, ghci_script, ['T18027.script'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment