Memory layout of boxed and unboxed ints?

This question already has an answer here:

  • Memory footprint of Haskell data types 2 answers

  • The GHC documentation has some good information. But basically, you're correct in saying that an Int value is a pointer to a thunk. However, an unboxed value is not a pointer to the unboxed value, it is the unboxed value itself. Also, the Haskell standard report merely gives the lower limit on the range of Int . IIRC, GHC Int 's have more than 30-bits.

    I don't think GHC uses the extra bits of unboxed types to store any metadata, but it does use the bits of pointers to do so. See this page for more details.

    链接地址: http://www.djcxy.com/p/43432.html

    上一篇: 在Haskell中删除类型?

    下一篇: 盒装和非盒装内存的内存布局?