I wanted to know: How much memory is my perl module consuming? Adam Kennedy had several times referenced the memory size of Perl modules, so I asked him how he figured it out. Here's the recipe he was kind enough to share, which I've reworked and embellished a bit for clarity:
Use ps.
> perl -de 1 > use Dependency::Of::YourMod::One; > use Dependency::Of::YourMod::Two;Then ps the process:
ps -O rss,vsz | grep 'perl -de'The second and third numbers you'll see are the resident and virtual memory size.
> use YourMod;Then ps the process again:
ps -O rss,vsz | grep 'perl -de'That difference covers the needs of the module itself, and ignores the dependencies.Now, that assumes that all your initialization runs at compile-time. If you have a singleton implementation you might need to create one to get the full module use.