Investigate high memory consumption of Git related endpoints
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=432592)
</details>
<!--IssueSummary end-->
## Summary
Some Git-related controller actions (like `TreeController` and `BlobController) are allocating more than `1GB` memory: https://nonprod-log.gitlab.net/app/r/s/rFTXv

The issue is not manifested in the production logs: https://log.gprd.gitlab.net/app/r/s/RzsTg
Related issue: https://gitlab.com/gitlab-com/gl-infra/delivery/-/issues/19847
issue