Perl Memory::Stats – Get RSS memory reporting on multiple platforms

It is often nice to be able to dump the current memory usage of a part of your process.

I’m working on Mac OSX, and I’m frustrating when a perl module only works on Linux, because it read file like ‘/proc’ or stuff like that.

Thanks to IRC users, I have discover Proc::ProcessTable, and then I have decide to create a module that use it to record the memory usage. The good point is that module work on Linux and Mac OSX, also on FreeBSD. I’m not sure on Windows.

My module is Memory::Stats, so how it works ?

You can also add checkpoints:

Enjoy !

Celogeek

Interesting read : Slide Asia YAPC for Memory Use

Short URL: http://sck.pm/0pm

One Pingback/Trackback

  • timbunce

    Are you *really* sure you want the RESIDENT Set Size? The examples you gave suggest it’s not what you want. For example, on a busy system RSS can go down while total process size is growing. RSS is only really useful for forking servers on systems using copy-on-write. You probably want ‘size’ instead of ‘rss’. See also http://www.slideshare.net/Tim.Bunce/perl-memory-use-yapcasia2012

    • http://blog.celogeek.com/ Celogeek

      Thanks a lot. I have add a link in the article to your slide. I will read it carefully when I’ve got time to breath

  • Pingback: Perl Memory::Stats | Weborama Dev Blog