Profiling heap memory usage on perl programs

2019-07-15 13:57发布

I have written a perl program to operate on huge datasets. I am trying to profile its excution in terms of its memory usage. Tried using valgrind on small datasets, but it slows down the execution dramatically. I am looking for just heap profiling. Could you guys suggest some ways ?

4条回答
可以哭但决不认输i
2楼-- · 2019-07-15 14:04

When I used Google and the search term 'perl memory profile', one of the first items points to the Perl module Devel::Size as one way of spotting memory usage. There are also memory leak detector modules lurking around.

查看更多
倾城 Initia
3楼-- · 2019-07-15 14:14

The new Devel::SizeMe module provides detailed visibility into the heap memory usage of a perl program or data structure. There's a blog post introducing Devel::SizeMe, including links to talk slides and screencast.

查看更多
疯言疯语
4楼-- · 2019-07-15 14:20

We used Devel::Leak. To work fully, you need a debugging compiled Perl, but even without that, you can count and log the number of allocated scalars, hashes, and arrays, as your code runs, at various key points. That was enough to pin down the leaks we had.

查看更多
来,给爷笑一个
5楼-- · 2019-07-15 14:21
登录 后发表回答