Fix memory leak in BA mount service 03/81903/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 5 May 2019 18:15:19 +0000 (20:15 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 6 May 2019 08:05:29 +0000 (08:05 +0000)
commit957533cbb972209e534c5bdb1bcad897ab01d3b2
treed6d1d031f4bcff5becf49bf29f35b4166d85ca1c
parentd274a95b5a043227369d7ea4a2157ba59779b2de
Fix memory leak in BA mount service

The cache used in BA mount service uses weakKeys() so the keys
(DOM mountpoint) could be GCed when no except cache, referenced
them).

However the values in the cache (BA mountpoint) also kept a reference
to the key, so the key was never weakly reachable and thus never GCed
resulting in a memory leak.

This is especially visible in case of frequent reconnects of netconf
mountpoints where after every reconnect a new DOM mountpoint is
created, requiring a new BA mountpoint creating new entry in the
cache of BA mount service.

This patch updates the entire suite of adapters, as it is shared
across all instances.

Change-Id: I9c109dd6d499d6185842d6a1ad5a59d75565af5c
Signed-off-by: Maros Marsalek <mmarsalek@frinx.io>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ae89c54f8019f53327001d1b916a53963097b34)
binding/mdsal-binding-dom-adapter/src/main/java/org/opendaylight/mdsal/binding/dom/adapter/AbstractBindingLoadingAdapter.java