Source Tree 1.5.7.1 memory leaks
Asked by Bi11:

Source Tree is a great git GUI on Mac OS.

But I found it may have memory leak issues.

When I run Source Tree one or two days, with two git and one hg repo window opened, it cosumes 2.7G memory of my 4G in total (shows in Activity Monitor, Real Mem), only left 20M free memory, makes system very very slow.

It always happened when I get back to the work in the morning of day, login window is very slow because Source Tree run out of all memory over the night, so I had to restart Source Tree once logged in.

It is really hard to test what causes it.


Answers:
author: Bi11
body: I've updated Source Tree to 1.5.8 and the memory leaks has gone.

I run Source Tree 1.5.8 over one week and the memory usage is around 200M. It is good.


author: Martin Sander
body: Still memory leaks present in version 2.2.2.

Put my Macbook Pro to sleep, next morning when waking it it had ran out of virtual memory, with sourcetree using 62 GB of (virtual) memory. Although the laptop was supposed to be sleeping...


author: G
body: I'm using 1.6.11 and this seems to be a problem with Git on Team Foundation Server 2013. At my previous job I used your product with Mercurial and it was flawless. My boss and I are trying to see if your product will be feasible for our development. Right now, it does not seem to be feasible. Any roadmap on getting this addressed, memory leaks seem to be a long standing problem? These repositories were just created so very little branches are open. Additionally, the preview windows for the file changes and branches just hangs when opening the project (see attached), those panes also hang at various times.

SourceTree-PoorPerformance.png  
[](https://community.atlassian.com/t5/Sourcetree-questions/Source-Tree-1-5-7-1-memory-leaks/qaq-p/320580?attachment-id=7755){#link_116cd6ed87aeef}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/9705/1/SourceTree-PoorPerformance.png){#display_116cd6ed87aeef_0}


author: Richard Lalancette
body: Simply maximizing and minimizing source tree window will cause memory leaks.

This needs to be addressed since it degrades overall system performance.


author: Chris Cinelli
body: After deleting some untracked files, putting some others in a git ignore and deleting some bookmarks to old project including one that did not exist anymore, the memory consumption went down. I still have some untracked files and it still seems that memory used by SourceTree is slowly growing.

comments: author: KieranA
body: Hi Chris,

I've put this one in JAC now as it's more difficult to follow here and JAC is used for bugs which this would be classified as. Here's the link: <https://jira.atlassian.com/browse/SRCTREE-1753>

If you want to add more detail in there to help track down the problem i.e. OS version, system specs, number of repos, whether any are on external storage (NAS etc.) and the likes then hopefully we can find the problem here.

Cheers


author: Chris Cinelli
body: Here you go:

![](../../upfiles/Screen_Shot_2013-07-30_at_12.56.11_PM.png)


author: Chris Cinelli
body: In case you need it:

![](../../upfiles/Screen_Shot_2013-07-30_at_12.58.27_PM.png)

Open files:

/

/Applications/SourceTree.app/Contents/MacOS/SourceTree

/Applications/SourceTree.app/Contents/Frameworks/Sparkle.framework/Versions/A/Sparkle

/Applications/SourceTree.app/Contents/Frameworks/Growl.framework/Versions/A/Growl

/Applications/SourceTree.app/Contents/Resources/stash.tiff

/Applications/SourceTree.app/Contents/Resources/tick-white16x16.tiff

/Applications/SourceTree.app/Contents/Resources/current_branch16x16.tiff

/Applications/SourceTree.app/Contents/Resources/arrow-branch16x16.tiff

/Applications/SourceTree.app/Contents/Resources/document-medium.tiff

/Applications/SourceTree.app/Contents/Resources/arrow-circle-double-grey.tiff

/Applications/SourceTree.app/Contents/Resources/modified.tiff

/Applications/SourceTree.app/Contents/Resources/arrow-branch-shadowless16x16.tiff

/Applications/SourceTree.app/Contents/Resources/notepadEditTemplate.tiff

/Applications/SourceTree.app/Contents/Resources/sidebarTemplate.tiff

/Applications/SourceTree.app/Contents/Resources/greybg.png

/Applications/SourceTree.app/Contents/Resources/byAtlassianFooter.tiff

/Applications/SourceTree.app/Contents/Resources/CheckmarkTemplate.tiff

/Applications/SourceTree.app/Contents/Resources/ClockTemplate.tiff

/Applications/SourceTree.app/Contents/Resources/SearchTemplate.tiff

/Applications/SourceTree.app/Contents/Resources/current_branch-shadowless16x16.tiff

/Applications/SourceTree.app/Contents/Resources/clean.tiff

/Applications/SourceTree.app/Contents/Resources/deleted.tiff

/Applications/SourceTree.app/Contents/Resources/English.lproj/DiffFileView.nib

/Applications/SourceTree.app/Contents/Resources/English.lproj/DiffHunkView.nib

/Applications/SourceTree.app/Contents/Resources/unknown.tiff

/Applications/SourceTree.app/Contents/Resources/server-network16x16.tiff

/Applications/SourceTree.app/Contents/Resources/remote-branch-shadowless16x16.tiff

/usr/lib/libgermantok.dylib

/Applications/SourceTree.app/Contents/Resources/conflict.tiff

/Applications/SourceTree.app/Contents/Resources/arrow_down16x16.tiff

/Applications/SourceTree.app/Contents/Resources/document-tree.tiff

/System/Library/Caches/com.apple.IntlDataCache.le.kbdx

/Applications/SourceTree.app/Contents/Resources/folder_finderstyle.tiff

/Applications/SourceTree.app/Contents/Resources/arrow_up16x16.tiff

/Applications/SourceTree.app/Contents/Resources/remote-branch16x16.tiff

/Applications/SourceTree.app/Contents/Resources/tag-label-blue-shadowless16x16.tiff

/Applications/SourceTree.app/Contents/Resources/Commit_All_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/Switch_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/trash_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/diff.tiff

/Applications/SourceTree.app/Contents/Resources/stash_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/add_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/trash_file_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/addremove_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/Fetch_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/Pull_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/Push_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/Branch32v32.tiff

/System/Library/Keyboard Layouts/AppleKeyboardLayouts.bundle/Contents/Resources/AppleKeyboardLayouts-L.dat

/Applications/SourceTree.app/Contents/Resources/git_16x16.tiff

/Applications/SourceTree.app/Contents/Resources/bookmarksButtonsStandIn.tiff

/Applications/SourceTree.app/Contents/Resources/tag_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/delete_32x32.tiff

/usr/share/icu/icudt49l.dat

/System/Library/Fonts/Keyboard.ttf

/Users/firstuser/Library/Keychains/Microsoft_Intermediate_Certificates

/Applications/SourceTree.app/Contents/Resources/database_add_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/folder_add_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/database_world.tiff

/Applications/SourceTree.app/Contents/Resources/Terminal_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/arrowCurveRightTemplate.tiff

/private/var/db/mds/messages/se_SecurityMessages

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db-shm

/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libcldcpuengine.dylib

/Applications/SourceTree.app/Contents/Resources/Merge_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/workflow.tiff

/Applications/SourceTree.app/Contents/Resources/reposettings.tiff

/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/SArtFile.bin

/Applications/SourceTree.app/Contents/Resources/database_go_32x32.tiff

/Applications/SourceTree.app/Contents/Resources/folder_database_32x32.tiff

/System/Library/Fonts/LucidaGrande.ttc

/Applications/SourceTree.app/Contents/Resources/page_white_database_32x32.tiff

/System/Library/Fonts/Helvetica.dfont

/private/var/folders/lx/glq33n9x1h3b7pvlh5p4l9p40000gn/C/mds/mdsDirectory.db

/Applications/SourceTree.app/Contents/Resources/WorldTemplate.tiff

/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc

/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/ImageFormats/unorm8_bgra.dylib

/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Latn2.data

/System/Library/PrivateFrameworks/CoreUI.framework/Versions/A/Resources/ArtFile.bin

/System/Library/PrivateFrameworks/XQuery.framework/Versions/A/XQuery

/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/ImageFormats/unorm8_rgba.dylib

/Library/Keychains/System.keychain

/Applications/SourceTree.app/Contents/Resources/document-column.tiff

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Resources/tokruleLE.data

/System/Library/Frameworks/AppKit.framework/Versions/C/Resources/Latn1.data

/System/Library/PrivateFrameworks/DataDetectorsCore.framework/Versions/A/Resources/com.apple.datadetectorscore.cache.urlifier.system

/System/Library/ColorSync/Profiles/Generic CMYK Profile.icc

/System/Library/Frameworks/Security.framework/PlugIns/csparser.bundle/Contents/MacOS/csparser

/System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/ImageFormats/unorm8_argb.dylib

/usr/share/langid/langid.inv

/Users/firstuser/Library/Keychains/login.keychain

/System/Library/Fonts/Menlo.ttc

/Applications/SourceTree.app/Contents/Resources/sourcetree.icns

/System/Library/Fonts/HelveticaNeue.dfont

/System/Library/Fonts/Monaco.dfont

/Library/Fonts/Microsoft/Arial.ttf

/usr/share/germantok/german.index

/private/var/folders/lx/glq33n9x1h3b7pvlh5p4l9p40000gn/C/com.apple.LaunchServices-037501.csstore

/usr/lib/dyld

/private/var/db/dyld/dyld_shared_cache_x86_64

/dev/null

/dev/null

/dev/null

count=1, state=0x2

/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Resources/Extras2.rsrc

/Users/firstuser/Library/Saved Application State/com.torusknot.SourceTreeNotMAS.savedState/data.data

count=0, state=0x1

/Users/firstuser/sandbox-Bloomboard

/Users/chris

/Users

/Users/firstuser/others

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/workspace/BBTracker

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/others/scraper-notifier

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/others/brisk

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/workspace/UploadServer

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/others/forumscraper

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/Bloomboard

/Users/chris

/Users

/Users/firstuser/workspace/BB

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/arcanist

/Users/chris

/Users

/Users/firstuser/less.js

/Users/chris

/Users

/Users/firstuser/others/photobook

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/others/priceupdown

/Users/firstuser/others

/Users/chris

/Users

/Users/firstuser/bloomboard-stash

/Users/chris

/Users

/Users/firstuser/hubot-hipchat

/Users/chris

/Users

/Users/firstuser/workspace/brochure-site

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/workspace/quotegen/hack

/Users/firstuser/workspace/quotegen

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/rebasetest

/Users/chris

/Users

/Users/firstuser/workspace/youtube-video-speed-bookmarklet

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/workspace/brochure-site2

/Users/firstuser/workspace

/Users/chris

/Users

/Users/firstuser/workspace/Bloomboard

/Users/firstuser/workspace

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db

FNetwork.defaultStorageSession

/Users/chris

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db-wal

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db-shm

/Users/firstuser/Library/Caches/com.torusknot.SourceTreeNotMAS/Cache.db-wal

-\>0xabc6e8837f4e0433

-\>0xabc6e88380b3fd93

/Users

/Users/firstuser/workspace/purposelist

/Users/firstuser/workspace

/Users/chris

/Volumes

count=1, state=0

/Users

/usr/share/germantok/german.index

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/Resources/tokruleLE.data

/usr/share/langid/langid.inv

/private/var/db/DetachedSignatures

/Users

count=0, state=0x1

count=0, state=0x1


author: Chris Cinelli
body: Just another note... I tried to close all the windows but leaving the app running and it does not release the memory.

comments: author: KieranA
body: Could you get us a screenshot of the detailed Activity Monitor view of SourceTree? It looks like this:

![](http://i.imgur.com/oR6svwI.png)


author: Chris Cinelli
body: git ls-files --exclude-standard --others \| wc -l

return 2949 that I think include the git ignored.

I think it should not take too much time to drop a folder of data there and run some tests if SourceTree start leaking. Otherwise I am not sure why it leaks for me but not for others.


author: Chris Cinelli
body: There are a few untracked files on the project, I am not sure if this is releated. In another thread I saw that a lot of untracked files can slow down SourceTree.

comments: author: KieranA
body: Hi Chris,

How many is a few? :)

Thanks in advance!


author: Chris Cinelli
body: It feels like it grows forever (at least until I kill it). I usually have only one window open even if I have a few repos bookmarked (not sure if you do some work on those). When I start it, it run with 65Mb. Then it start to increase (the highest that I saw was 5.7Gb. I noticed that after closing and reopening the laptop the memory increased too. If you have a way to monitor the activity and dump it in a log, I am willing to run it on my machine.

Best,

Chris

comments: author: KieranA
body: Just as a note Chris, if you're using Activity Monitor then it's not a reliable way of determining if there's memory leaks, more advanced tools need to be used such as Instruments to detect them. Also, SourceTree is garbage collected and it detects retain loops and other various leaks, so it should always clean up the memory regardless of there's holds on memory allocations.

How are you determining there's a memory leak?


author: Chris Cinelli
body: No particular actions... pulling and pushing. We use git flow but the memory keep growing even without using git-flow actions on SourceTree.

Our repo has a lot of commits but I am not so sure that is the problem.  
I also have a few files not checked in GIT (those with the (?)), a few stashes and 15 braches.

Just fetching and pushing make the memory goes up 10-30Mb. Actually each time that there is the spinning refresh wheel, I see a little increase.   

It takes very long sometime to refresh the status of the archive.  

I have other colelgues that sees the memory used by SourceTree going up but I haven't seen number \> 1GB on other people's screen (I can double check).

I am kind of thinking to checkout again from scratch the repo to see if it helps.

Best,

Chris

comments: author: KieranA
body: If you've got a lot of repo windows open then that could be a contributing factor. Mine will use 100MB with the SourceTree repository open for example. It sounds like a memory leak if it's continually growing, but it'd be good to find a particular case where this happens. Does it forever grow? If so, that sounds like a memory leak.


author: Chris Cinelli
body: Runinning SourceTree 1.6.2.2. Yesterdat it reached almost 6GB. Today so far is as 2.26Gb :-(

comments: author: KieranA
body: Hi Chris,

This is the only report I've had of 1.6.2.2 memory leaks. Are there any particular actions you're doing for this to happen?

Cheers


author: KieranA
body: Thanks very much for the report. Memory leaks are high up on our list and I fully appreciate it's very difficult to nail down where the problem lay. I'll get 1.5.7.1 to be run for a couple of days on one of our machines. Could I just find out how many repositories you have and your system specs (including free disk space).

comments: author: Bi11
body: Mid 2011 Mac Mini / 4G DDR3 / 500G HDD, 460G Free

A few of small git and hg repos (\<100 files) and

two large git repos (e.g., libav).