flush xorg image cache?
Roland Mainz
roland.mainz at nrubsig.org
Sat Apr 23 16:33:38 PDT 2005
Alan Cox wrote:
>
> On Mer, 2005-04-20 at 17:59, Roland Mainz wrote:
> > heap size - and due the implementation of most default memory allocators
> > in unix/linux the heap size cannot shrink[1].
>
> ITYM "In unix"
>
> To quote the glibc manual on "Efficiency Considerations for 'malloc'"
>
> --
> Very large blocks (much larger than a page) are allocated with
> `mmap' (anonymous or via `/dev/zero') by this implementation. This has
> the great advantage that these chunks are returned to the system
> immediately when they are freed. Therefore, it cannot happen that a
> large chunk becomes "locked" in between smaller ones and even after
> calling `free' wastes memory. The size threshold for `mmap' to be used
> can be adjusted with `mallopt'. The use of `mmap' can also be disabled
> completely.
> --
>
> So for the Linux case mallopt should be all you need to touch.
That's for Linux/glibc but not for all the other OSes. Additionally only
relatively long-living memory such as pixmaps should be allocated using
|mmap()| as this always results in a syscall (AFAIK Jim Gettys said some
while ago that the Xserver code is a good exercise in avoiding
syscalls... :) and may require some additional adjustments (for example
I'd like to force the usage of large pages (64K, 512K, 4M) for pixmap
memory to save some entries in the TLB).
----
Bye,
Roland
--
__ . . __
(o.\ \/ /.o) roland.mainz at nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O;)
More information about the xorg
mailing list