"ld" memory usage
Bertram Felgenhauer
bertram.felgenhauer at googlemail.com
Sat Apr 17 09:59:16 EDT 2010
Roman Beslik wrote:
> This is not strictly a GHC question. I observed that "ld" when
> linking GHC-compiled programs eats 0.5 GB of resident memory. ~3
> times more than GHC or Haddock.
Oh I remember investigating this problem 2 years ago. Looking back it
seems I never made my observations public.
GNU ld uses hash tables to store the symbols of each object file. The
default size of those hash tables is 4051, which is a huge waste in
Haskell's split-objs case, where object files are plenty and only have
a couple of dozen symbols (most of them external references) at most.
I've been running binutils with this patch,
http://int-e.home.tlink.de/haskell/binutils-2.18-tune-bfd-hash.patch
(still applies to 2.20)
which changes the default size to 31 and adds some more intermediate
sizes. This improves memory usage a lot, at a small cost in running time
(if I had numbers, they're lost by now).
HTH,
Bertram
More information about the Glasgow-haskell-users
mailing list