- Backport memory leak fix from 4.2
- Fix memory leak : remove stream when deleting thread