I am trying to profile my application. When analyzing memory usage with -hc
RTS option, I noticed lots of memory marked as PINNED. When running with -hy
the memory is marked as ARR_WORDS
.
The program creates a 2400×2400 matrix of doubles using Data.Packed.Matrix
module from hmatrix package, and since the elements in it should be stored in continuous memory, I don't see a way for the matrix to take up so much space.
My question is: what does the PINNED word actually mean? Also is there a way to get further information on why and where the memory is used?
The whole source code in question is on GitHub, should anyone be interested in it. However, it is very far from minimal example.
"Pinned" data means that the garbage collector is not allowed to move it. This helps, for example, when passing data to C functions via the FFI. You wouldn't want the GC to move the data whilst the C call is executing.
Soylet Green gave the relevant link above (https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/GC/Pinned).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With