Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory usage of optimize_mp increases over time #81

Open
Jhsmit opened this issue Jan 17, 2019 · 2 comments
Open

Memory usage of optimize_mp increases over time #81

Jhsmit opened this issue Jan 17, 2019 · 2 comments

Comments

@Jhsmit
Copy link
Owner

Jhsmit commented Jan 17, 2019

When running a large batch of optimizations in parrallel, the memory usage gradually increases over time.
(Ubuntu, 6.7k cells, i7-8700K, 12 processes)

context manager with close() does not seem to help.

https://stackoverflow.com/questions/18414020/memory-usage-keep-growing-with-pythons-multiprocessing-pool
https://chase-seibert.github.io/blog/2013/08/03/diagnosing-memory-leaks-python.html

@Jhsmit
Copy link
Owner Author

Jhsmit commented Jan 21, 2019

https://stackoverflow.com/questions/24717468/context-managers-and-multiprocessing-pools

from multiprocessing import Process
from multiprocessing.pool import Pool

class SafeProcess(Process):
    """ Process that will cleanup before exit """
    def run(self, *args, **kw):
        result = super().run(*args, **kw)
        # cleanup however you want here
        return result


class SafePool(Pool):
    Process = SafeProcess

pool = SafePool(4) # use it as standard Pool

@Jhsmit Jhsmit added this to the Performance update milestone Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant