[commit: ghc] wip/rwbarton-biniface: Use half as much memory when reading interfaces (84fa482)

git at git.haskell.org git at git.haskell.org
Mon Feb 20 05:30:45 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/rwbarton-biniface
Link       : http://ghc.haskell.org/trac/ghc/changeset/84fa48224dafc32fcb7e906ad248048e32370865/ghc

>---------------------------------------------------------------

commit 84fa48224dafc32fcb7e906ad248048e32370865
Author: Reid Barton <rwbarton at gmail.com>
Date:   Sun Feb 19 20:05:06 2017 -0500

    Use half as much memory when reading interfaces


>---------------------------------------------------------------

84fa48224dafc32fcb7e906ad248048e32370865
 compiler/utils/Binary.hs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index b10ab1d..a1ccee3 100644
--- a/compiler/utils/Binary.hs
+++ b/compiler/utils/Binary.hs
@@ -207,7 +207,7 @@ readBinMem filename = do
   h <- openBinaryFile filename ReadMode
   filesize' <- hFileSize h
   let filesize = fromIntegral filesize'
-  arr <- mallocForeignPtrBytes (filesize*2)
+  arr <- mallocForeignPtrBytes filesize
   count <- withForeignPtr arr $ \p -> hGetBuf h p filesize
   when (count /= filesize) $
        error ("Binary.readBinMem: only read " ++ show count ++ " bytes")



More information about the ghc-commits mailing list