ASCII-art from the Eclipse memory analyzer (use monospaced font and a wide window to view):
A large number of SendUpdatedViews are referenced in the monitors array:
Class Name | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
com.icesoft.util.MonitorRunner$1 @ 0xfffffffe6cd92500 Monitor Runner Thread | 2,561 | 184 | 430,248 | 3,720
'- this$0 com.icesoft.util.MonitorRunner @ 0xfffffffe6cd18f40 | 2,561 | 32 | 430,248 | 9,672
'- monitors java.util.ArrayList @ 0xfffffffe6cd18f60 | 2,561 | 40 | 430,248 | 9,640
'- elementData java.lang.Object[679] @ 0xfffffffe91963ae0 | 2,561 | 5,456 | 430,248 | 9,600
- [12] com.icesoft.faces.webapp.http.core.SendUpdatedViews @ 0xfffffffe88a97840
|
51 |
80 |
8,568 |
272 |
- [465] com.icesoft.faces.webapp.http.core.SendUpdatedViews @ 0xfffffffefd6f3ef0
|
27 |
80 |
4,536 |
272 |
'- activeServer com.icesoft.faces.webapp.http.core.SendUpdatedViews$5 @ 0xfffffffefd6f3fe8 |
27 |
48 |
4,536 |
72 |
'- val$pageTest com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet @ 0xfffffffefd6f31d0 |
27 |
88 |
4,536 |
2,645,568 |
'- views java.util.Collections$SynchronizedMap @ 0xfffffffefd6f33a0 |
27 |
56 |
4,536 |
838,808
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
views held by MainServlet pageTest:
Class Name | Ref. Objects | Shallow Heap | Ref. Shallow Heap | Retained Heap
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[2] class com.icesoft.faces.util.event.servlet.ContextEventRepeater @ 0xfffffffe3d832058 | 1,438 | 96 | 241,584 | 239,584
'- servletContextConfiguration com.icesoft.faces.webapp.http.servlet.ServletContextConfiguration @ 0xfffffffe6d980a30 | 1,438 | 32 | 241,584 | 32
'- context weblogic.servlet.internal.WebAppServletContext @ 0xfffffffe614ce790 | 1,438 | 392 | 241,584 | 565,480
'- attributes weblogic.servlet.internal.AttributesMap @ 0xfffffffe61789098 | 1,438 | 32 | 241,584 | 4,816
'- attributes java.util.concurrent.ConcurrentHashMap @ 0xfffffffe617890b8 | 1,438 | 72 | 241,584 | 4,784
'- segments java.util.concurrent.ConcurrentHashMap$Segment[16] @ 0xfffffffe61789100 | 1,438 | 152 | 241,584 | 4,712
'- [4] java.util.concurrent.ConcurrentHashMap$Segment @ 0xfffffffe617898f0 | 1,438 | 48 | 241,584 | 1,160
'- table java.util.concurrent.ConcurrentHashMap$HashEntry[2] @ 0xfffffffe6d73d008 | 1,438 | 40 | 241,584 | 1,064
'- [1] java.util.concurrent.ConcurrentHashMap$HashEntry @ 0xfffffffe6d73d030 | 1,438 | 48 | 241,584 | 48
'- value com.icesoft.faces.webapp.http.servlet.MainServlet$3 @ 0xfffffffe6cd18c28 | 1,438 | 80 | 241,584 | 219,182,600
'- sessionBoundServers java.util.HashMap @ 0xfffffffe6cd18c78 | 1,438 | 64 | 241,584 | 219,180,256
'- table java.util.HashMap$Entry[1024] @ 0xfffffffe7a21b410 | 1,438 | 8,216 | 241,584 | 219,180,192
- [796] java.util.HashMap$Entry @ 0xffffffff01bd9108
|
58 |
48 |
9,744 |
11,769,192 |
|
- next java.util.HashMap$Entry @ 0xfffffffe803db5b0
|
51 |
48 |
8,568 |
10,412,960 |
|
- value com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet @ 0xffffffff019d02e0
|
7 |
88 |
1,176 |
1,356,184 |
|
'- views java.util.Collections$SynchronizedMap @ 0xffffffff019d0548 |
7 |
56 |
1,176 |
632
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
SessionDispatcher is a singleton attached to MainServlet.
It had a direct reference to a map of sessionBoundServers which belonged to a variety of sessions.
This has been replaced with a WeakHashMap, so if the session goes away, we do not keep the reference.
A key was also added to the session itself, because without that the WeakHashMap would not keep the objects and they would likely go away immediately.
SendUpdatedViews was modified so that globally accumulated updates would not hold a reference to the MainSessionBoundServlet beyond the session lifetime.