perl 5.8.2 memory leak?

Brandon D. Valentine brandon at
Wed Jan 21 22:44:48 PST 2004

On Wed, Jan 21, 2004 at 06:22:00PM -0800, Bakken, Luke wrote:
> One difference I did note is in the output of perl -V:
> 5.6.1 -> usemymalloc -> 'n'
> 5.8.2 -> usemymalloc -> 'y'

The perl5 and perl5.8 ports both have a WITH_PERL_MALLOC option.  If
this option is defined then the port uses Perl's malloc (usemymalloc=y),
if it's undefined it uses the system malloc (usemymalloc=n).  In
lang/perl5.8 the default is to use Perl's malloc unless WITH_THREADS is
defined, in which case it falls back to using the system malloc.  In
lang/perl5 the default is to use the system malloc.  I am uncertain why
the defaults are set differently between the two versions of Perl.
Perhaps the Perl maintainer could shed some more light on that.  At any
rate if you build lang/perl5.8 with WITHOUT_PERL_MALLOC defined you can
test your theory that the Perl malloc is the cause of your memory leak.  

[ For future reference, everything I told you above could have been
divined from a glance at the relevant port Makefiles. ]

Your code could be exposing a bug in the Perl malloc implementation.
You should also consider the possibility that your code or one of the
modules you are making use of is the cause of the memory leak and
perhaps the Perl malloc implementation merely exacerbates the problem.
At any rate the best way to find out is to create the simplest possible
example program which triggers the bug.  Take that program and run it
through a Perl interpreter on FreeBSD using both the Perl malloc and the
system malloc and then do the same on a Linux machine and compare.  If
you do this, please take that information and file an upstream bug
report against Perl.


Brandon D. Valentine
brandon at                 
Pseudo-Random Googlism:  truth is relative einstein's theory may have to
                         be turned on its head

More information about the freebsd-ports mailing list