Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Qt memory usage: 7% for a minimal app

    Reply
    realsportcars | # 1 | 2010-06-28, 14:45 | Report

    Hello guys,
    I "wrote" a really minimal application using Qt and QtCreator.
    This app do nothing, only display an empty window with a title.

    I discover that an application like this use 7% of memory on N900 (measured with conky and top). My question is: why? there is a way to improve this?

    If you want try this only create a GUI application from QtCreator and run it on N900 using QtCreator debug option.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Rob1n | # 2 | 2010-06-28, 15:20 | Report

    Originally Posted by realsportcars View Post
    Hello guys,
    I "wrote" a really minimal application using Qt and QtCreator.
    This app do nothing, only display an empty window with a title.

    I discover that an application like this use 7% of memory on N900 (measured with conky and top). My question is: why? there is a way to improve this?

    If you want try this only create a GUI application from QtCreator and run it on N900 using QtCreator debug option.
    What are you measuring there? Virtual size, resident size, or non-shared memory? Most of the memory in a basic app like that will probably be the Qt libraries, which will be shared between all apps using them.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    w00t | # 3 | 2010-06-28, 15:25 | Report

    Not just Qt, either.

    On Maemo (in particular), Qt uses Hildon/Gtk+ to render widgets, which will also (wrongly) be attributed to that 7%.

    There has been some recent work ongoing in parts of Qt to help lower resource usage (particularly in text rendering), but my advice would be to just not focus on this too heavily unless you notice it becoming a real problem.

    Also keep in mind: http://en.wikipedia.org/wiki/Program...en_to_optimize ('premature optimisation' is the phrase - there are likely better resources, I'm writing this quickly.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to w00t For This Useful Post:
    realsportcars

     
    realsportcars | # 4 | 2010-06-28, 15:29 | Report

    you are right, but i can't answer to your question. Conky only display a generic "mem" and also top doesn't give more advice than "%mem" on N900.

    I dont think that only the libs can takes so much memory but i'm not sure. If they are shared and i open a second application like this, its memory usage must be really low. is it?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Rob1n | # 5 | 2010-06-28, 15:49 | Report

    From my readings, the %MEM indicator in top measures the resident size, and should exclude shared libraries (though top also indicates 0k shared memory, so it may not be working that out correctly).

    Edit | Forward | Quote | Quick Reply | Thanks

     
    realsportcars | # 6 | 2010-06-28, 15:56 | Report

    From my point of view this is a vexing problem, but based on what wrote w00t i think that "normal" developer can't do very much to solve this. I hope Qt next version can remove this problem

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Rob1n | # 7 | 2010-06-28, 16:04 | Report

    Originally Posted by Rob1n View Post
    From my readings, the %MEM indicator in top measures the resident size, and should exclude shared libraries (though top also indicates 0k shared memory, so it may not be working that out correctly).
    I've done a little digging, and it looks like shared libraries are included in the memory usage of each app (it's non-trivial for the system to calculate it any other way), so this'll be what makes up most of the memory usage. You should be able to get an idea of the incremental memory cost of the application by seeing how much the free memory changes when it's started. This should differ depending on whether you have other Qt applications running or not.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to Rob1n For This Useful Post:
    realsportcars

     
    realsportcars | # 8 | 2010-06-28, 16:09 | Report

    Originally Posted by Rob1n View Post
    I've done a little digging, and it looks like shared libraries are included in the memory usage of each app (it's non-trivial for the system to calculate it any other way), so this'll be what makes up most of the memory usage. You should be able to get an idea of the incremental memory cost of the application by seeing how much the free memory changes when it's started. This should differ depending on whether you have other Qt applications running or not.
    Thank you! i will do this try and see what happen...

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout