I am using C language and Linux as my programming platform.
In my app, I call pthread_create. Then I check the memory usage of my app using ps commandline tool and it adds 4 in the VSZ column.
But the problem is when the pthread_create function handler exits, the 4 that was added in the memory was not release. Then when the app call the pthread_create again, a 4 value was added again until it gets bigger.
I tried pthread_join and it seems the memory still getting bigger.
Thanks.
psis not the right tool to measure memory leaks. When you free memory, you are not guaranteed to decrease the process’ vsize, both due to memory fragmentation and to avoid unnecessary system calls.valgrindis a better tool to use.