main and background thread example
-
Did you check the memory used by you application ?
-
what do you mean by check? and no, how should i?
-
Using the top command for example. Valgrind etc.
-
okay, thanks.
one last question, as you can see, on timer's timeout i execute a function. is it possible stop the timer (so the function won't be executed), and then restart it again? -
-
hi again,
i ran valgrind and it says there's a memory leak onexec()
which is inrun()
overridden method. so what's wrong? -
@user4592357 said in main and background thread example:
ThreadObj obj;
m_thread = std::thread(&ThreadObj::work, &obj);obj is allocated on the stack, it will go out of scope and delete itself
-
hi, thanks for the reply.
the code has been modified since the first post (see my last code-post), so it's not the problem -
i've read similar articles, saying "you shouldn't subclass
QThread
". in my case i need to do that. -
Out of curiosity, what are you doing that requires to subclass QThread ?
-
nothing requires it. it's just that the whole implementation is done and i don't wanna change everything