Good news. Could you identify the source of the leak' in the OP's code? Is it detach?
In reply to Re^2: memory leaks with threads by BrowserUk in thread memory leaks with threads by misc