[KDE Dot News]
 faq
 flatforty
 contribute
 subscribe
 configure
 search
 rdf

 main
 parent
 thread


Re: Memory usage..
by Leo S on Thursday 27/Mar/2008, @10:03
Yep I've done this before on some special widgets, like one that displays frames from a camera.

However I just did an experiment on an app I'm working on. The biggest memory cost is obviously the main window widget itself. It has a huge double buffering pixmap, and takes the most memory. So what happens if you disable double buffering on just the main widget, but leave it enabled on all others?

Well, on the plus side, there is no added flicker, even if you disable double buffering on the main widget. All the widgets that actually would flicker, like buttons, menus, checkboxes, etc. are still double buffered, so the UI is just as nice as before. And the vast majority of the memory hit is gone. A maximized window takes about 6mb less Xorg memory when I disable double buffering on the main window.

However, there is one downside. Widgets that are transparent now have a grey background instead. So checkboxes have a grey rectangle background instead of letting the default style background show through. This is with the oxygen style.
If you choose the Plastique style instead, then everything looks much better. Because the window background is grey anyway, the fact that checkboxes are not transparent is irrelevant. So in this case you get the 6mb of ram back for basically free. Not really a realistic option for most apps, but hey..

I attached a comparison screenshot of the same app running with double buffering disabled on the main widget, using the oxygen and the plastique style to see the difference.
  Related Links
 ·   Articles on Interviews
 ·   Also by Leo S
 ·   Contact author

  File Attachment
  • Click to download attachment buffering.png
    48KB (49837 bytes)

  • Thread Threshold:

    The Fine Print: The following comments are owned by whomever posted them.
    ( Reply )

    Re: Memory usage..
    by koos on Thursday 27/Mar/2008, @13:38
    Sounds like a great idea, since lots of windows are there as a container for other widgets. In my little extra gear project, the main window is completely covered with dock windows.
    However with qt4.4 coming soon, there is only one native window and thus one double buffer. Just tried it with trunk and indeed the app looks completely broken with setAttribute(Qt::WA_PaintOnScreen);, docks aren't updated properly neither is the menubar and statusbar.
    [ Reply To This | View ]
    • Re: Memory usage..
      by Leo S on Thursday 27/Mar/2008, @13:57
      >> However with qt4.4 coming soon, there is only one native window and thus one double buffer.

      Are you sure? I think each widget still has its own double buffer. The native window issue is separate.
      [ Reply To This | View ]
      • Re: Memory usage..
        by Anon on Thursday 27/Mar/2008, @14:11
        Your analysis is correct.
        [ Reply To This | View ]
      • Re: Memory usage..
        by koos on Thursday 27/Mar/2008, @14:38
        No, just a guess actually. Hmm, I need to figure out why the app is so broken then, maybe paint events aren't passed to child widgets ...
        [ Reply To This | View ]

     
    The Fine Print: The previous comments are owned by whomever posted them.
    ( Reply )

      "In my free time I try to avoid computers as far as possible." -- Matthias Elter
    KDE®, "K Desktop Environment", "KDE Dot News", "got the dot?" and the KDE Logo® are trademarks or registered trademarks of KDE e.V. in the European Union, the United States and other countries. All other trademarks and copyrights on this page are owned by their respective owners. Comments are owned by the poster. The rest: Copyright © 2000-2008 KDE e.V. for The KDE Project. For further information or comments on this site, please contact the Webmaster.
    [ home | post article | flat forty | subscribe | search | rdf ]