chewiebug/GCViewer — pull request #110 by nigelzor (2014-08-19 17:24:24+00:00)
Title: Reduce memory consumption

I happened to look at a heap profile while working on #109 and a couple of things stood out.
- don't create a new TreeMap for every GCEvent
- don't create a new ExtendedType every time a Type needs to be wrapped

With several files open, before:
```
num #instances #bytes class name
----------------------------------------------
1: 4168426 300126672 com.tagtraum.perf.gcviewer.model.GCEvent
2: 4168479 200086992 java.util.TreeMap
3: 2789273 111570920 java.util.TreeMap$Entry
4: 1402942 69452336 [C
5: 2819605 67670520 com.tagtraum.perf.gcviewer.model.AbstractGCEvent$ExtendedType
6: 1384200 57072608 [Ljava.lang.Object;
7: 1401933 33646392 java.lang.String
8: 1381253 33150072 java.util.ArrayList
9: 4556 817864 [I
10: 3913 416968 java.lang.Class
...
Total 19622099 878679208
```

and after, with the same files open:
```
num #instances #bytes class name
----------------------------------------------
1: 4168426 333474080 com.tagtraum.perf.gcviewer.model.GCEvent
2: 1402840 69441928 [C
3: 1384188 57072064 [Ljava.lang.Object;
4: 1401831 33643944 java.lang.String
5: 1381253 33150072 java.util.ArrayList
6: 4557 817904 [I
7: 3910 416688 java.lang.Class
8: 945 370440 javax.swing.JLabel
9: 694 239944 [B
10: 7322 234304 java.util.Hashtable$Entry
...
Total 9846317 532732120
```