-
Notifications
You must be signed in to change notification settings - Fork 643
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 increase while using the client #2855
Comments
@Ncoder2 I'm a bit surprised as we use python-gitlab for multiple long-running services that iterate over hundreds of thousands of projects and users on a weekly basis, and haven't seen issues. Do you have some results you could share? Is there a reason to instantiate the client in every iteration instead of just once? |
@nejch , Thanks for the quick response, i just changed the above example code and tried to keep the Gitlab object creation out of the loop and the consumption has reduced. However, our use case is again to get project details of all projects using the gitlab client and take necessary actions/perform code scan etc. We are using the gitlab client in a fastapi server, when we run a scan on say 1000s of projects, somehow the projects.get increases the memory the fastapi server restarts. In our code, we dont instantiate the gitlab object everytime though. |
HI @nejch , what would you suggest for this usecase: Solution 1:
Solution 2:
Asking the two solutions to understand how would gitlab object behave when concurrent requests are made, gitlab project details object is created from the same gitlab object |
Description of the problem, including code/CLI snippet
When using the python gitlab client and calling any function say project details for example, there is a constant increase in memory and does not reduce with time. We tested this by running the get projects via http_get method in a loop, the memory kept increasing
Expected Behavior
function calls can increase memory but should be cleared once the call is complete
Actual Behavior
memory keeps increasing every time
Specifications
Test Code to reproduce the behaviour, please replace token and project_id
The text was updated successfully, but these errors were encountered: