Closed h-nakai closed 3 years ago
I found. The dict named async_task, size of this dictionary is on the rise
Hello @h-nakai,
thanks for that very precice issue description. I never imagined that this could be a problem but if your use case actually involves creating that many models, I will implement a clean up for that dictionary.
@aleneum Thanks for the reply. We plan to create many sessions, so it would be helpful if you could make some corrections. I appreciate your help.
Tentatively. We'll going to override the Machine's init. In the init of the AsyncMachine, I'm going to define an async_task.
Please checkout the branch dev-async-tasks and let me know if that tackles your issue. I added a test which creates 100 models and checks whether AsyncMachine.async_tasks
is empty after all models had been used.
Thanks for the quick fix. I have confirmed that there are no memory leaks.
It has been running for a while, but so far it is working normally. We will be using this branch as a solidified whl file until this fix is released to pip.
Would you like me to close it once?
Hi @h-nakai,
I released 0.8.4 which includes the fix for the memory leak. Please close this issue when you transitioned to 0.8.4. I will then delete the dev-async-tasks
branch.
I got it.
We will check the operation within a few days. After that, we will close this ticket.
Correction confirmed. Close this ticket. thank you for quick fix, aleneum.
Version: 0.8.3 (also occurred in 0.8.2)
We've been using Machine, but we've adopted AsyncMachine to add a new API call process. However, the use of asyncmachine caused a memory leak.
I also tried gc.collect(), but it didn't improve it. (return value is 0 and there are no content in gc.garbage)
small sample code is included here.