malloc vs ptmalloc2

Andrew MacIntyre andymac at bullseye.apana.org.au
Mon Feb 14 04:10:12 PST 2005


David Schultz wrote:
> Other than that, I don't know enough
> details about ptmalloc to speculate, except to say that for most
> real-world workloads on modern systems, the impact of the malloc
> implementation is likely to be negligible.  Of course, test
> results would be interesting...

Some language interpreters by design malloc()/realloc()/free() memory 
constantly. Python being a well known example of such an interpreter.

Because the issues with memory allocators are legion in the context of a 
multitude of platforms, Python eventually gained a highly specialised 
allocator geared to its usage patterns (which brought some other 
benefits with it too).  I think I've seen references to Perl doing 
something similar.

The performance degradations due to corner cases in allocator design 
exposed by Python (when using native platform allocators rather than its 
own) is often painful.

Nothing comes for free though, and Python's allocator has a limitation 
that a small percentage of users find painfull - it doesn't return 
vacant arenas to the OS, which with some usage patterns gives rise to 
large amounts of wasted swap space.

-------------------------------------------------------------------------
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
         andymac at pcug.org.au             (alt) |        Belconnen ACT 2616
Web:    http://www.andymac.org/               |        Australia


More information about the freebsd-hackers mailing list