BUG-4556: enable DataSchemaContextTrees to be scavenged
DataSchemaContextTree contains an internal weak-keyed cache, which is
used to speed up lookups and share DataSchemaContextNodes.
Unfortunately the cache uses strong references for values (e.g.
DataSchemaContextTree) instances, which transitively (via
DataSchemaContextNode) retain the reference to the key. This has the
effect of the key being always reachable, thus causing a memory leak.
Make the cache use weak references for values, which ensures that it
gets scavenged whenever its contents are no longer referenced.
Change-Id: I1684d1bf2c2c5cdc44cda1e8e508149ff3a8fae4
Signed-off-by: Robert Varga <rovarga@cisco.com>