summaryrefslogtreecommitdiff
path: root/compiler/utils/Binary.hs
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2017-02-23 13:54:36 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-23 17:26:44 -0500
commit12e21d35ee1b77f5f2bb8bd747848f07a32d592f (patch)
treee9e05af3e3f0557fb74fe27694520c20aa3940e1 /compiler/utils/Binary.hs
parentbb1c660f3e0f1b471eb74cbb02275b97db3fa8b4 (diff)
downloadhaskell-12e21d35ee1b77f5f2bb8bd747848f07a32d592f.tar.gz
Use half as much memory when reading interfaces
I don't see any reason for the (filesize*2), and experimentally allocations do go down slightly after this change. Test Plan: validate Reviewers: simonmar, austin, bgamari, trofi Reviewed By: bgamari, trofi Subscribers: trofi, thomie Differential Revision: https://phabricator.haskell.org/D3164
Diffstat (limited to 'compiler/utils/Binary.hs')
-rw-r--r--compiler/utils/Binary.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs
index b10ab1d5f2..a1ccee3ae7 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")