[framework] AgentFabric local deploy has memory leak
Initial Checks
- [X] I have searched GitHub for a duplicate issue and I'm sure this is something new
- [X] I have read and followed the docs & demos and still think this is a bug
- [X] I am confident that the issue is with modelscope-agent (not my code, or another library in the ecosystem)
What happened + What you expected to happen
I deploy the apps/agentfabric in local. The entire deployment process is successful.
But when we visit the web page, the system memory of the Python process will continue to rise and will not fall.
Memory rise occurs when the new visits/refresh the tab pages.
The memory use after a period of time is as follows:
How to solve this problem?🤔
Versions / Dependencies
base on conda python: 3.10 os: Linux centos / macos(docker fedora40) ((we both tried)) cuda: Linux centos:11.7 / macos:None torch: Linux(torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2) / macos(torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 cpu) both requirements.txt has been installed. git branch: master
Reproduction script
None
Issue Severity
High: It blocks me from completing my task.
This is a known issue, it is aleady on our todo list. Since you mentioned this problem, we will put it in a high priority, and fix this problem in next release.
The main reason for this issue, is the agent is not fully gc, so each time a new agent instantiated it will consume memory, and when you leave, it is still hold the memory.