Author image Tom van der Woerdt
and 1 contributors

NAME

Devel::Jemallctl - Insight into what Jemalloc is doing

SYNOPSIS

Basically, Devel::MallInfo for Jemalloc.

    use Devel::Jemallctl;

    my $stats = Devel::Jemallctl::refresh_and_get_stats;
    printf "Current allocated/active/metadata/resident/mapped: %d/%d/%d/%d/%d",
        @$stats{qw/stats.allocated stats.active stats.metadata stats.resident stats.mapped/};

Requires a jemalloc compiled with --enable-stats.

DESCRIPTION

glibc uses mallinfo for exporting statistics, jemalloc has its own mallctl, which means that Devel::MallInfo is useless when using jemalloc. This module aims to cover the same use case: finding out how much memory a Perl process is using.

Hopefully in the future more mallctl options will be added, allowing for actual configuration of jemalloc in addition to getting statistics out.

FUNCTIONS

refresh_and_get_stats

Refreshes jemalloc's internal stats and returns basic stats, if available.

    my $stats = Devel::Jemallctl::refresh_and_get_stats;

Outputs jemalloc's statistics on STDERR. Useful for quick analysis.

    Devel::Jemallctl::print_stats();

AUTHOR

Tom van der Woerdt, <tvdw@cpan.org>

LICENSE AND COPYRIGHT

Copyright 2017 Tom van der Woerdt.

Full license see README