Threadpool comment
leon-barrett opened this issue · 1 comments
Hi. I am the author of Claypoole, and a friend pointed out that you're using it. That's great, and I'm super excited, so I had to check out your project! In looking at your usage, I noticed a minor point that might help improve your thread usage.
Alas, threadpools in Java aren't automatically garbage collected. In runner.clj, you create a threadpool but don't shut it down. That could potentially leak threads, leading to a growing number of threads sitting around. It's likely not an issue, as those threads go away when the process stops, but it could trip you up in a long-running process.
Instead of explicitly allocating the pool, you can just specify the pool size when using upmap
. Then, an appropriately-sized pool will be allocated and cleaned up automatically.
(let [...
results (->> test-nses
(threadpool/upmap 20 ...)
...)
...]
...)
Thanks for the tip, added.