如何使用 vgdb 在 Valgrind Massif 中强制创建新快照?

发布于 2025-01-12 01:36:19 字数 606 浏览 6 评论 0原文

我使用 Valgrindmassif 工具来监视发生内存分配的所有代码部分。在本例中,我使用此命令使用 Valgrind 运行我的程序:

valgrind --tool=massif --vgdb=full --pages-as-heap=yes --detailed-freq=1 --threshold=0.001 --max-snapshots=100 --time-unit=ms ./myprogram

我的问题是,运行程序 30 分钟后,它开始分配更多内存。我想监视代码的哪些部分正在分配内存。我应该注意到,这不是内存泄漏,因此我没有使用 Memcheck 而是使用了 massif。该命令一开始从内存中获取快照,但之后,我就没有内存中的快照了。

为了解决这个问题,我使用 vgdb 命令按照以下方式拍摄详细快照:

vgdb detailed_snapshot

但看起来这个命令正在使用捕获的快照,而不是新的快照。那么如何在需要时拍摄新快照呢? 或者我应该以某种方式释放捕获的快照?

I am using Valgrind with the massif tool to monitor all parts of code that memory allocation occurs. In this case, I used this command to run my program using Valgrind:

valgrind --tool=massif --vgdb=full --pages-as-heap=yes --detailed-freq=1 --threshold=0.001 --max-snapshots=100 --time-unit=ms ./myprogram

My problem is that after 30 mins of running the program, it starts allocating more memory. I want to monitor that which parts of the code are allocating memory. I should notice that this is not a memory leak so I didn't use Memcheck rather I used massif. This command takes snapshots from memory at the beginning but after that, I have no snapshots from memory.

To solve this problem I used the vgdb command to take detailed snapshots in the way below:

vgdb detailed_snapshot

But looks like this command is using the captured snapshot, not a new one. So how can I take a new snapshot when I want?
Or should I release the captured snapshot in some way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文