简体   繁体   中英

Profiling heap memory usage on perl programs

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?

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.

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 .

use Memchmark .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM