maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Qt memory usage: 7% for a minimal app (https://talk.maemo.org/showthread.php?t=57337)

realsportcars 2010-06-28 14:45

Qt memory usage: 7% for a minimal app
 
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.

Rob1n 2010-06-28 15:20

Re: Qt memory usage: 7% for a minimal app
 
Quote:

Originally Posted by realsportcars (Post 732718)
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.

w00t 2010-06-28 15:25

Re: Qt memory usage: 7% for a minimal app
 
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.

realsportcars 2010-06-28 15:29

Re: Qt memory usage: 7% for a minimal app
 
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?

Rob1n 2010-06-28 15:49

Re: Qt memory usage: 7% for a minimal app
 
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).

realsportcars 2010-06-28 15:56

Re: Qt memory usage: 7% for a minimal app
 
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

Rob1n 2010-06-28 16:04

Re: Qt memory usage: 7% for a minimal app
 
Quote:

Originally Posted by Rob1n (Post 732813)
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.

realsportcars 2010-06-28 16:09

Re: Qt memory usage: 7% for a minimal app
 
Quote:

Originally Posted by Rob1n (Post 732831)
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...


All times are GMT. The time now is 10:03.

vBulletin® Version 3.8.8