develooper Front page | perl.perl5.porters | Postings from March 2007

Useless use of realloc

Thread Next
From:
Rafael Garcia-Suarez
Date:
March 21, 2007 10:09
Subject:
Useless use of realloc
Message ID:
b77c1dce0703211008j1ced7716k3beae7135daaa96d@mail.gmail.com
Oh look :

$ strace -etrace=mremap perl -e '$s.="x"for 1..300_000' 2>&1 | head -1
mremap(0xb7c3b000, 262144, 262144, MREMAP_MAYMOVE) = 0xb7c3b000

This is on linux. The mremap syscall is used by the glibc to implement
realloc under linux. But here, the old size and the new size of the
memory blocks are the same, which means that at some point we probably
called realloc() without needing to.

That's annoying.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About