I am working on some multi-thread code with pthreads. When I discovered some memory-leaks (via valgrind), I simply added some
cout << " new [some name of class for me]" << endl;
in part of constructors, because I thought I have removed all of them. This revealed that part of them are launched before main(). I have removed everything from main(), so it looks like:
int main(){
return 0;
}
Even without any #includes those constructors are still invoked. I think nothing from the previous code should be invoked in this case. I used “project clean” option in eclipse and try to delete binaries (Debug/Release). Nothing helps ..
What is the purpose of that? What else I can do?
Thanks in advance.
globalandstaticvariables are initialized beforemain. Except for thestaticvariables declared inside a function. They are initialized on a first call. So I think you should look at the static and global variables