Commit 12e21d35 authored by rwbarton's avatar rwbarton Committed by Ben Gamari

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
parent bb1c660f
......@@ -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")
......
......@@ -58,14 +58,15 @@ test('T4018',
test('T4029',
[stats_num_field('peak_megabytes_allocated',
[(wordsize(64), 80, 10)]),
[(wordsize(64), 76, 10)]),
# 2016-02-26: 66 (amd64/Linux) INITIAL
# 2016-05-23: 82 (amd64/Linux) Use -G1
# 2016-07-13: 92 (amd64/Linux) Changes to tidyType
# 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565)
# 2017-02-12: 80 (amd64/Linux) Type-indexed Typeable
# 2017-02-20: 76 (amd64/Linux) Better reading of iface files
stats_num_field('max_bytes_used',
[(wordsize(64), 24151096, 5)]),
[(wordsize(64), 22016200, 5)]),
# 2016-02-26: 24071720 (amd64/Linux) INITIAL
# 2016-04-21: 25542832 (amd64/Linux)
# 2016-05-23: 25247216 (amd64/Linux) Use -G1
......@@ -77,6 +78,7 @@ test('T4029',
# 2017-01-18: 21670448 (amd64/Linux) Float string literals to toplevel
# 2017-02-07: 22770352 (amd64/Linux) It is unclear
# 2017-02-12: 24151096 (amd64/Linux) Type-indexed Typeable
# 2017-02-20: 22016200 (amd64/Linux) Better reading of iface files
extra_hc_opts('+RTS -G1 -RTS' ),
],
ghci_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