PDA

View Full Version : QThreads and memory overshoot for embedded linux enviroment



Ratheendrans
10th June 2013, 13:18
Dear All,

We are facing an unusal behaviour of Qt in windows and embedded linux enviroment.

Our embedded application uses six thread to achive its computing goals. threads consists of RF reader,sensor,keypad,Tcp server,GUI thraed etc.
so in the main.cpp we create threads and start them,this enters the event loop.

we found these observations
1. when we run the applications,memory used in embedded board overshoots to 123% for 64 MB RAM for top command on linux. same application utilizes 24MB of RAM on windows.
2. When we create and start a dummy thread for test,there is significant change in the memory for embedded linux (approx 13%) while on windows/linux PC the increase is insignificant.



our dummy code for test

class myThread : public QThread
{
Q_OBJECT
public:
virtual void run();
~myThread();

public slots:

private:
Priority pri;
};



int main(int argc, char *argv[])
{
QApplication a(argc, argv,QApplication::GuiServer);
myThread obj1,obj2,obj3;
obj1.start();
obj2.start();
obj3.start();

return a.exec();

}




The obove code show significant difference in memory usage for board compared to PC linux

Ratheendrans
11th June 2013, 06:17
Hi

If the message is inadequate/missing i am adding more info below.

my problem is if I take a Qthread instance and run on embedded linux platform I get change(increase) in memory usage,while on the PC linux there is no change.

can anyone give your valuable feedback on this.

anda_skoa
11th June 2013, 09:06
Maybe it help to measure the memory usage with a more reliable tool than top, e.g. exmap http://www.berthels.co.uk/exmap/
See http://blogs.kde.org/2005/09/15/measuring-memory-usage for a discussion on why top is not really good at producing usage numbers.

Cheers,
_

wysota
11th June 2013, 11:56
Also it is likely you can reduce the number of threads in your application. For example the TCP server most likely doesn't need its own thread. Other components you mentioned can also work in the main thread if they provide some non-blocking API for checking their state.