bug in mallocForeignPtrBytes (both 6.4 and 6.6)

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Sep 24 13:34:04 EDT 2006


On Sun, 2006-09-24 at 01:28 +0400, Bulat Ziganshin wrote:
> Hello Duncan,
> 
> Sunday, September 24, 2006, 12:22:38 AM, you wrote:
> 
> >> after program prints "40 mb allocated" look at Task Manager indication
> >> - it shows that two times more memory actually in use. it seems that
> >> problem is only with allocating memory buffers whose sizes are powers
> >> of 2 or very close - bug shows for bufsize = 4kb, 1mb or 4095, but not
> >> not for 4000 or 10^6
> 
> > The reason for this is that for larger objects ghc has an allocation
> > granularity of 4k. That is it always uses a multiple of 4k bytes.
> 
> with 512k blocks it also allocates two times more data than requested.

Oh, sorry I missed that point. Something fishy is going on then.

Duncan



More information about the Glasgow-haskell-users mailing list