Haskell程序的-hc配置文件中PINNED是什么意思? [英] What does PINNED mean in -hc profile of Haskell program?

查看:227
本文介绍了Haskell程序的-hc配置文件中PINNED是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图描述我的应用程序。当使用 -hc RTS选项分析内存使用情况时,我发现标记为PINNED的内存很多。当以 -hy 运行时,内存被标记为 ARR_WORDS



该程序使用hmatrix包中的 Data.Packed.Matrix 模块创建2400×2400双精度矩阵,并且由于其中的元素应存储在连续内存中,我没有看到矩阵占用太多空间的方法。




我的问题是:PINNED字实际上意味着什么?还有一种方法可以获得有关内存使用的原因和位置的更多信息吗?



有问题的整个源代码是在GitHub上,是否应该有人对此感兴趣。但是,它与最小示例非常相似。

解决方案

固定数据意味着垃圾收集器不允许移动它。例如,这有助于通过FFI将数据传递给C函数。您不希望GC在执行C调用时移动数据。



Soylet Green给出了上面的相关链接( https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/Storage/ GC /固定)。

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).

这篇关于Haskell程序的-hc配置文件中PINNED是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆