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

Useless use of realloc

Thread Next
Rafael Garcia-Suarez
March 21, 2007 10:09
Useless use of realloc
Message ID:
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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About