`task_thread` can leak memory
altrisi opened this issue ยท 0 comments
Every time you pass a different value as the pool, it will create a new ThreadPoolExecutor
to be used for that value and add it to a map in ScriptHost
. However, that executor is never removed from the map, effectively creating a memory leak.
Fixing this issue isn't as simple as using a WeakHashMap
, because the Value objects are really just holders that are not reused, so garbage collection wouldn't kick in in appropriate times and would remove executors when they should be kept, plus even if that worked it would likely remove them from the map quite early.