bug in mallocForeignPtrBytes (both 6.4 and 6.6)

Bulat Ziganshin bulat.ziganshin at gmail.com
Sat Sep 23 05:58:41 EDT 2006


Hello glasgow-haskell-users,

the attached program show up the bug in mallocForeignPtrBytes (and
newPinnedByteArray#) implementation - it allocates two times more
memory as requested. The bug seen both on 6.6rc and june 6.4 windows
builds, namely:

http://www.haskell.org/ghc/dist/current/dist/ghc-6.5.20060901-i386-unknown-mingw32.tar.gz
http://www.haskell.org/ghc/dist/stable/dist/ghc-6.4.2.20060609-i386-unknown-mingw32.tar.gz

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

-- 
Best regards,
 Bulat                          mailto:Bulat.Ziganshin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mallocForeignPtrBytes.hs
Type: application/octet-stream
Size: 505 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20060923/5fc875c4/mallocForeignPtrBytes.obj


More information about the Glasgow-haskell-users mailing list