NAME
Devel::Mallinfo -- mallinfo() memory statistics
SYNOPSIS
use Devel::Mallinfo;
my $hashref = Devel::Mallinfo::mallinfo();
print "uordblks used space ", $hashref->{'uordblks'}, "\n";
# or import into your namespace per Exporter
use Devel::Mallinfo ('mallinfo');
my $hashref = mallinfo();
DESCRIPTION
Devel::Mallinfo is an interface to the C library mallinfo function giving various totals for memory used by malloc. This is meant for development, to give you an idea what your program and libraries are using or not.
It should be noted malloc isn't the only way memory can be used. Program and library data and bss segments and the occasional direct mmap don't show up in mallinfo. But normally almost all runtime space goes through malloc, so it's close to the total, and dynamic runtime usage is often what you're interested in anyway.
FUNCTIONS
Devel::Mallinfo::mallinfo()-
Return a reference to a hash of the
struct mallinfovalues obtained frommallinfo. The keys are field name strings, and the values are integers. For example,{ 'arena' => 1234, 'uordblks' => 5678, ... }So for instance to print all the fields (in no particular order),
my $info = Devel::Mallinfo::mallinfo(); foreach my $field (keys %$info) { print "$field is $info->{$field}\n"; }See the
mallinfoman page, or the GNU C Library Reference Manual section "Statistics for Memory Allocation with `malloc'", for what the fields mean.All the fields in
struct mallinfoon your system should be available since they're grepped out of malloc.h byDevel::Mallinfoat build time. Some systems don't have amallinfoat all, or only have it in a particularmalloclibrary; ifmallinfoisn't available in themallocPerl is using thenDevel::Mallinfo::mallinforeturns a reference to an empty hash.
OTHER NOTES
On a 64-bit system with a 32-bit "int", the int fields used in struct mallinfo might overflow (and wrap around to small or negative values). This is a known C library problem, which Devel::Mallinfo doesn't try to do anything about.
HOME PAGE
http://www.geocities.com/user42_kevin/devel-mallinfo/index.html
LICENSE
Devel::Mallinfo is Copyright 2007 Kevin Ryde
Devel::Mallinfo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Devel::Mallinfo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Devel::Mallinfo. If not, see http://www.gnu.org/licenses/.
SEE ALSO
mallinfo(3)