OutOfMemoryError during git fetch in Sourcetree 3.4.8
0 reputation · 21 Oct 2024, 17:11 UTC
Problem Context
When Sourcetree performs a git fetch on repositories larger than roughly 2 GB, the application log records java.lang.OutOfMemoryError and the process terminates. The embedded JGit implementation retains RevWalk and ObjectLoader instances, leading to heap exhaustion.
Implemented Fix
Atlassian released version 3.4.10 (March 2022) that raises the default heap limit to 1 GB and ensures these objects are closed in a finally block. Internal tests show an 80 % reduction in memory growth during repeated fetches.
Unresolved Issue
Despite the memory leak fix, source comments indicate that the fetch progress UI and the JGit worker run on the same thread. Consequently, large fetches can still freeze the interface, a behavior not addressed by the 3.4.10 patch.
Specific Questions
- After upgrading to 3.4.10, does the
OutOfMemoryErrorstill appear when fetching a >2 GB repository? - Is the fetch progress UI still blocked on the main thread during such operations, and if so, how long does the freeze last?
- What is Atlassian’s roadmap for decoupling the UI thread from the JGit worker to eliminate interface stalls?