Wednesday, June 20, 2012

POSIX Thread Memory Leaks.

For years, I've been hunting down some nasty memory leaks in the applications I've been using.  The code for the most part is inherited and I haven't been able to wrap my head around it.  This latest discovery though after reading some documentation and code has given me something to chase.

Tracking down memory leaks from multi-threaded applications is a nightmare, but I'm seeing some rational logic behind it now based on this IBM article on POSIX threads.
And I quote:
If you create a joinable thread but forget to join it, its resources or private memory are always kept in the process space and never reclaimed. Always join the joinable threads; by not joining them, you risk serious memory leaks.


Well, I'll be damned!

No comments: