Pushing image transport logic down the stack

Peter "Firefly" Lund firefly at diku.dk
Wed Sep 6 08:44:40 PDT 2006


On Wed, 6 Sep 2006, Owen Taylor wrote:

> As far as I know, the above is about as simple as you can get for
> /temporarily/ allocating a shared memory buffer. Until you
> munmap and ftruncate, you have a permanent reservation of memory
> that has to be swapped out to disk to be reused by another
> application. If an application can accurately predict its future image
> transport needs, using a pre-allocated buffer is an obvious strategy.

But perhaps you can save the munmap/ftruncate/mmap triplet between 
buffers sometimes by delaying the deallocation a bit.

While I am at it: would it be a good idea to only use ftruncate() to set 
sizes that are a multiple of the page size?

It might avoid some nasty corner cases in the operating system (and thus 
avoid running into OS errors) and it might be faster.

What we really want, of course, is system-wide weak pointers, potentially 
with finalizers ;)

-Peter



More information about the xorg mailing list