How to disable/limit pixmap cache in X

Gavin McCullagh gmccullagh at gmail.com
Wed Sep 19 09:08:22 PDT 2007


Hi (and apologies for breaking thread),

Glynn Clements wrote 

> The server doesn't "cache" pixmaps, it stores them.
> 
> [The server may cache some of those pixmaps in video RAM, with the rest
> stored in the server's memory, but this isn't visible to the client.]
> 
> A "cache" duplicates information which is available elsewhere in order to
> improve performance. The term implies that the cached data can be
> discarded at will, with the only consequence being increased "cost" if
> the data is required later.

I guess Jim's use of the term "caching" is from the perspective of firefox
-- in that firefox still has access to the compressed image files and can
at increased cost, re-create the pixmaps.

It would seem that Firefox (or rather Gecko) leaves the images in the video
ram, whereas others such as Konqueror and Opera do not.  This would
certainly seem to be a Gecko bug.  It is being worked on, at least in some
sense

	https://bugzilla.mozilla.org/show_bug.cgi?id=296818

though to be honest, having a timeout seems like turning a bug into a race.

> A pixmap is an image which is stored by the server. If a client tells the
> server to create a pixmap, failure to do so is likely to be considered a
> "fatal" error by the client. Once the server has created a pixmap, it is
> required to store it until the client explicitly tells the server to free
> it.

I'm not an expert in X, so please excuse (and feel free to correct) me if I
have read this situation wrong.  In the same sense as a web client should
never be able to crash a web server, surely an X client should not be able
to crash an X server?  I would have thought for the sake of the X server
and its user, it should be able to prevent a client from using arbitrary
amounts of memory.  Perhaps this is my idealistic or even wrong point of
view?

It probably would be a fatal error for the client, but that's okay.  I'd
rather the client crash than the server.  Clients can then be fixed to
react nicely if creation of a pixmap gets refused.  

> If an application makes "excessive" use of pixmaps, this has to be dealt
> with in the client.

I agree, except that one cannot chase every rogue application down to
ensure stability of the X server.

> > It appears that the ability to cache pixmaps to RAM is not a necessity
> > and rather a feature to help speed up image access.
> 
> Yes and no.
> 
> The client could store the image itself (as an XImage), and send the
> image data to the server whenever it wants the image to be drawn.
> However, this is the client's decision; if the client decides to store
> the image in the server (as a pixmap), the server doesn't really have
> much choice in the matter.

Is this fundamental to how X servers and clients interact?  Is it really
not feasible for the server to refuse, in order to preserve itself and the
other running applications?

Gavin




More information about the xorg mailing list