diff options
author | Jonatan Kronqvist <jonatan@vaadin.com> | 2013-08-28 13:53:45 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-09-02 09:41:39 +0000 |
commit | e6af0f0a5a1333d06e18d0149d44231a5f8e654d (patch) | |
tree | 4c0db65d396d318c20c69bfca65d6b16c9ce31ea /server/src/com/vaadin/util/CurrentInstance.java | |
parent | d8b0b504894255543e68f074b30051a91f8a1154 (diff) | |
download | vaadin-framework-e6af0f0a5a1333d06e18d0149d44231a5f8e654d.tar.gz vaadin-framework-e6af0f0a5a1333d06e18d0149d44231a5f8e654d.zip |
Avoid leaking memory from inherited ThreadLocales. Fixes #12401
The issue is fixed by changing the normal HashMap inside the inheritable
thread local to a map implementation holding only weak references to the
values (WeakValueMap).
Also included is a test UI that starts threads, which run until the JVM
is quit. This along with VisualVM was used to reproduce the issue and
verify the fix.
Change-Id: I116cc4e56e8a19c3b770abab6b18b9e262f4dafa
Diffstat (limited to 'server/src/com/vaadin/util/CurrentInstance.java')
-rw-r--r-- | server/src/com/vaadin/util/CurrentInstance.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/server/src/com/vaadin/util/CurrentInstance.java b/server/src/com/vaadin/util/CurrentInstance.java index b97bab3d8a..a1c543117d 100644 --- a/server/src/com/vaadin/util/CurrentInstance.java +++ b/server/src/com/vaadin/util/CurrentInstance.java @@ -60,7 +60,7 @@ public class CurrentInstance implements Serializable { return null; } - Map<Class<?>, CurrentInstance> value = new HashMap<Class<?>, CurrentInstance>(); + Map<Class<?>, CurrentInstance> value = new WeakValueMap<Class<?>, CurrentInstance>(); // Copy all inheritable values to child map for (Entry<Class<?>, CurrentInstance> e : parentValue.entrySet()) { |