realloc (using forkbomb) benchmark results

Radim Kolar hsn at netmag.cz
Mon Feb 16 02:21:57 PST 2004


I have tested memory allocation speed in Linux and FBSD with ports/benchmark/forkbomb. This test is doing realloc(1M) realloc(2M), ...
Results are:

-M writes into allocated memory, -m don't

freebsd 5.2
./forkbomb -l 64 -i 256 -M --quit  16.77s user 21.38s system 98% cpu 38.591 tota
l
./forkbomb -l 64 -i 256 -m --quit > /dev/null  16.12s user 31.30s system 98% cpu
 48.329 total

Linux/glib2.3.2
(hsn at tty2):~/forkbomb% time ./forkbomb -l 64 -i 256 -m --quit > /dev/null 19:22
./forkbomb -l 64 -i 256 -m --quit > /dev/null  0.00s user 0.00s system 0% cpu
+0.000 total
(hsn at tty2):~/forkbomb% time ./forkbomb -l 64 -i 256 -M --quit > /dev/null 19:24
./forkbomb -l 64 -i 256 -M --quit > /dev/null  0.02s user 0.59s system 96% cpu
+0.634 total

Results shows:
a) FBSD uses too much user time: 
    can't extend last block while realloc()ing without copying it to other  place. This should be easy to fix.
b) if FBSD writes to allocated memory, results are better! Comments?
c) if linux don't writes into memory, it doesn't do anything.
d) linux has remap() syscall which is used for memory resizing in realloc()
e) Linux uses mmap() for allocating block much larger than page. FreeBSD is
doing brk() allocation.
f) freebsd brk() vs linux remap() is 31 vs 0.6 sec.


More information about the freebsd-performance mailing list