Perl 5.8.1-RC4 release notes mention FreeBSD malloc upto 200 times slower than perl malloc

Yusuf Goolamabbas yusufg at outblaze.com
Mon Sep 8 23:51:52 PDT 2003


In the Perl 5.8.1-RC4 release notes posted here

http://dev.perl.org/perl5/news/2003/perl-5.8.1-RC4.html

it mentions about the Platform specific problems seen by the Perl
development team. 
----------------------------------------------------------------------
FreeBSD: malloc dilemma

The choice of malloc (the C-level memory management interface) when
building Perl is problematic in FreeBSD.

Using FreeBSD's system malloc for Perl was found to be very slow: in
some cases that was 200 times slower than using the Perl malloc. One
such case is file input: for example

# slurping the whole compressed Perl source code into $a
if (open F,"perl-5.8.1.tar.gz") { local $/; $a=<F> }

is about 200-250 times slower with the system malloc than with the Perl
malloc.

One could use Perl's malloc (Configure -Dusemymalloc), but that was
found to cause random core dumps in FreeBSD with multithreaded programs.
No such problems were found in other platforms, however.

A decision was made to stick with the system malloc, regardless of the
performance problems.
----------------------------------------------------------------------

Maybe the test case can assist FreeBSD kernel hackers to make malloc
faster.

Regards, Yusuf


More information about the freebsd-hackers mailing list