Skip to content

Commit

Permalink
Fix thread pool memory leak
Browse files Browse the repository at this point in the history
Fixes #108.
  • Loading branch information
tiraffe authored and mtth committed Dec 11, 2018
1 parent 2e86523 commit 25778f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions hdfs/client.py
Expand Up @@ -1125,6 +1125,10 @@ def _map_async(pool_size, func, args):
"""
pool = ThreadPool(pool_size)
if sys.version_info <= (2, 6):
return pool.map(func, args)
results = pool.map(func, args)
else:
return pool.map_async(func, args).get(1 << 24) # 6+ months.
results = pool.map_async(func, args).get(1 << 24) # 6+ months.

pool.close()
pool.join()
return results

0 comments on commit 25778f8

Please sign in to comment.