Performance of mmap/munmap on linuxppc 2.4

Stephen Williams steve at icarus.com
Sat Oct 2 01:50:34 EST 2004


I need to allocate, reallocate(down), and release lage image
buffers, and I've been thinking in terms of using mmap and
anonymous mapping to get the memory:

       void*ptr = mmap(0, cur->size_, PROT_READ|PROT_WRITE,
                       MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);

I also munmap the tail of this region when I know how big the
image really is, and munmap the rest when the image is done.
I'm doing this the hard way (instead of using malloc/realloc)
because I want to guarantee that the realoc functionality doesn't
move the data.

So am I shooting myself in the foot performance-wise here?
I'm using a 233MHz 405GPr. I expect to be allocating/freeing
these image buffers 30-50 times a second for 4meg-ish regions,
or somewhat slower for regions 60meg or so. I have no swap.


-- 
Steve Williams                "The woods are lovely, dark and deep.
steve at icarus.com           But I have promises to keep,
http://www.icarus.com         and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."




More information about the Linuxppc-embedded mailing list