This message was posted on behalf of Intel Corporation1 of 1 people found this helpful
Thanks for your interest in the Intel Edison Platform.
We appreciate all the information provided. We were investigating and we’d like to suggest you to try using Valgrind- Massif: a heap profiler, it will help you to identify space leaks that aren’t detected by traditional leak-checkers. You can find detailed information here: http://valgrind.org/docs/manual/ms-manual.html. Additionally, in this thread you can find how to install Valgrind: running valgrind.
Hope you find this information helpful.
Within minutes of installing and using valgrind I found the cause of the memory leak!
In my code to subscribe to MediaRenderer events I was creating a thread to send an HTTP SUBSCRIBE message, and receive the reply.
When sending new messages I was creating new threads - which is OK, the threads were being constructed and terminating properly, however I was re-using the same pthread_t member variable in my class each time I called pthread-Create(...).
Sometimes a new thread was being created before the old one exited, and therefore it was corrupting the previous pthread_t passed into pthread_create(...). This meant there were numerous orphaned threads that the kernel could not clean up because their pthread_t had been overwritten.
It was simple solution and my processes %VSZ has now dropped from 300% to just a steady 6% and is not growing!