+2

Improve SmartGit memory usage for large repositories

Christopher Kline 7 years ago updated by Marc Strapetz 7 years ago 3

SmartGit's current memory usage is fairly excessive. In our 257,000 file repo, here's what I'm seeing when launching SmartGit64.exe without smartgit.vmoptions file:


  • 380 MB: sitting idle at the "Welcome to SmartGit!" dialog before selecting a repo
  • 816 MB: sitting idle after selecting repo and letting initial refresh complete
  • 860 MB: after opening a log window and then closing it
  • 952 MB: after opening a second repo in the same SmartGit instance, opening a log window and closing it
  • 952 MB: after closing the second repo and using Debug->Run GC a few times
  • At this point the "SmartGit is close to the configured memory limit" dialog pops up

In the past I've used the -Xmx2300m vm option to avoid the memory limit warning, but then SmartGit uses up closer to 2GB of RAM in normal usage (and "Run GC" does nothing to lower it).


This is a lot of memory to give up just to use source control, especially on the VMs we use for development. Would it be possible to do a pass to see if there's any unnecessarily large data structures or redundant data that could be de-duplicated?


Did you check the allocated memory in some operating system tool (like the Windows task manager) or in a Java profiler, like jvisualvm? I'm asking because after closing a Log window or closing a repository *and* invoking the garbage collector, the heap size should definitely go down (I've just verified both). This still does not mean that the garbage collector will actually release physical memory back to the system. The behavior of the garbage collector depends on the operation system, too. Thus, more details, including VM telemetries like the one produced by jvisualvm would be helpful.

All I checked was that, from the O/S perspective, all the memory was actually committed and part of the working set, and does not change (materially) when invoking GC. Perhaps the Java VM is holding onto memory even if not needed by SmartGit, but from my perspective as a user of the product I just see excessive memory use.


Personally I would rather not have to deal with the details of the underlying language/runtime the product is based upon.


Its been two decades since I did significant work in Java, and I'm no expert, but would it be possible to reduce the memory allocations (temporary and/or long-term) done by SmartGit in general, so that the garbage collector has less to deal with in the first place?


If there's some logging or command I can run for you using the standard Oracle java client install, I'm happy to do that. But I'm not familiar with the current state of Java profilers so you'd have to tell me what commands you wanted me to try.

Please have a look at following How-To which explains using JVisualVM to profile SmartGit:

http://www.syntevo.com/doc/display/SG/Inspecting+SmartGit%27s+process+using+JVisualVM


In a first step it would be important to understand whether Used heap size properly decreases when closing a Log or a repository or whether there might actually be some kind of memory leak. It would also be interesting whether you can get the overall (reserved) Size to decrease when invoking Perform GC from within JVisualVM.