guofei9987 / scikit-opt

Genetic Algorithm, Particle Swarm Optimization, Simulated Annealing, Ant Colony Optimization Algorithm,Immune Algorithm, Artificial Fish Swarm Algorithm, Differential Evolution and TSP(Traveling salesman)
https://scikit-opt.github.io/scikit-opt/#/en/
MIT License
5.3k stars 989 forks source link

请教多进程模式下,如何释放占用内存 #208

Closed reborn-sama closed 11 months ago

reborn-sama commented 1 year ago

例如,使用GA优化的多进程模式, 设置 set_run_mode(worker, 'multiprocessing') 在数个迭代后会爆内存,是否有方法可以将GA调用的所有内存释放

Hayden-CHENPRO commented 1 year ago

i want to ask this question too

Hayden-CHENPRO commented 1 year ago

这个我现在解决了,得去改源码。scikit-opt 遗传算法里面创建进程池后没有调用pool.close()和pool.join(),导致子进程资源没被释放,在源码的x2y函数里重新实现一下多进程就好了

wizard-creator commented 1 year ago

我也遇到这个问题了,改一下func_transformer里面的pool()使用就好了