[Uml-devel] It's Qt BUG !! Re: Howto reduce X11 memory usage with several QCanvas / QCanvasView instances

Achim Spangler Achim.Spangler at mnet-online.de
Mon Jun 28 07:59:03 UTC 2004


Hi,
I tracked down the problem, and found the reason for this strange behaviour 
( sent parallel a bug report to qt-bugs at trolltech.com ).

I tried to control the double buffering with 
QCanvas::setDoubleBuffering( bool ) based on the hide and show events of the 
QCanvasView class ( exactly the derived UMLView class ).

HideEvent -> call QCanvas::setDoubleBuffering( false )
ShowEvent -> call QCanvas::setDoubleBuffering( true )

==> Voila the memory usage is reduced as reported by xrestop:
res-base Wins  GCs Fnts Pxms Misc   Pxm mem  Other   Total   PID Identifier

Without DoubleBuffer Control:
3200000   480  125    5  534  301   330484K     26K 330510K   ?   
MiniVegN.UseCases.xmi - Umbrello UML-Modeller

With DoubleBuffer Control:
3400000   478  110    5  487  192     6504K     23K   6528K   ?   
MiniVegN.UseCases.xmi - Umbrello UML-Modeller

Each time the IDENTIC project file, and all other source code unchanged.

==> Reduction from 330484K  to 6504K

See the attached patch for my workaround to solve this problem.

I think this could be a valuable workaround for other KDE applications which 
use several QCanvas instances - like tabbed browsing for konqueror.

I would be interested in a test with all KDE applications using this for all 
hide/show events of their QCanvas(View).

Bye,
Achim

Am Montag 28 Juni 2004 15:13 schrieb Lubos Lunak:
> On Monday 28 of June 2004 14:04, Achim Spangler wrote:
> > Am Sonntag 27 Juni 2004 15:23 schrieb Lubos Lunak:
> > > Dne čt 24. června 2004 21:48 Achim Spangler napsal(a):
> > > > So I have the following questions:
> > > > 1) What can cause this high memory usage of X11 ( the umbrello
> > > > footprint would be acceptable )?
> > >
> > >  QPixmap's are stored in the XServer. Every pixmap takes roughly
> > > width*height*depth/8 bytes of memory in the XServer.
> >
> > Is there a possibility to tell X11 / Qt that all items on a Canvas should
> > be only displayed with a lower color depth than the X11 desktop has in
> > general - i.e. my screen/ X11 desktop has 24Bit. Thus even simple
> > diagrams which contain mostly QCanvasRectangle ( plain color - no shapes
> > or other effects ) instances can cause a lot of memory usage.
> >
> > I think that there is no way to tell the X11 server / Qt to use some
> > method of compression for hided QCanvas instances - or is there a
> > possibility to do this or comparable?
>
>  X11 pixmaps can have lower depths, QPixmap seems to support only
> monochrome and full depth. But that'd be probably just too much trouble. If
> it's really QCanvas causing this high usage, then QCanvas should get
> optimized. I suggest you ask on qt-bugs@ or some Qt forum.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DoubleBuffering.patch
Type: text/x-diff
Size: 1770 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20040628/56c08706/attachment.bin>


More information about the umbrello-devel mailing list