summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorRoland Senn <rsx@bluewin.ch>2020-06-07 14:03:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-10 04:17:34 -0400
commit9b283e1b2a46af614d89b0e3a0dfd23871511c17 (patch)
treef455f0e6d899cc88aa9c007822c1be13c21a27ab /libraries
parent32fd37f5e1e6dc6e3b664ae41e0041ed8a19ae21 (diff)
downloadhaskell-9b283e1b2a46af614d89b0e3a0dfd23871511c17.tar.gz
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.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/ghci/GHCi/Run.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/ghci/GHCi/Run.hs b/libraries/ghci/GHCi/Run.hs
index b34ba1553f..0a99845966 100644
--- a/libraries/ghci/GHCi/Run.hs
+++ b/libraries/ghci/GHCi/Run.hs
@@ -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