[Haskell-cafe] Over-allocation

Stefan O'Rear stefanor at cox.net
Wed Nov 21 08:47:08 EST 2007


On Wed, Nov 21, 2007 at 01:31:35PM +0000, Gracjan Polak wrote:
> 
> Hi,
> 
> My program is eating too much memory:
> 
> The source.txt is 800kb, and I expect files of size 100 times more, say 80MB, so
> using -H800M will not help here much.
> 
> The profile -p says:
> 
> COST CENTRE                    MODULE               %time %alloc
> 
> xparse                         PdfModel              78.1   95.0

You're using the wrong type of profiling for this job.  -p is intended
for people who want their programs to go faster; and %alloc is raw
allocations, showing how to divide the GC cost.  Since you are
allocating 100 times more data than is being retained, the %alloc
figures are quite uncorrelated with leakiness.

But you don't want to make your program faster - you want to make it
leaner.  You want one of the heap profiling flags, described in:

http://haskell.org/ghc/dist/current/docs/users_guide/prof-heap.html

Note that heap profiling is even more a black art than time profiling;
you may need to do a lot of experimentation to find an enlightening
profile.

Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20071121/57ee0e7e/attachment.bin


More information about the Haskell-Cafe mailing list