Dispose ClientChangesImpl ChangeSets to minimize memory footprint
This change stems from the fact that
org.simantics.db.common.changeset.GenericChangeListener gives ChangeSets
as an argument to DB requests which can leave strong references to the
ChangeSet instances in the DB QueryProcessor until the DB client
garbage collects these requests. Usually DB client request parameters
should be immutable, but in this case the request is never listened to
for changes so it is OK dispose of the ChangeSet parameter after all
DB ChangeListeners are notified.
This change adds a Disposable implementation to ClientChangesImpl which
minimizes the memory footprint of the class down to 192 bytes compared
to ~2^17 bytes. The instances can take up a very considerable amount of
memory if not disposed. It has not been uncommon to see multiple
gigabytes of memory being spent by these byte[] buffers that are not
really used anymore but still referenced.
Once more note that this is not a case of memory leakage but simply bad
use of memory through over-sized buffers that were GC'ed eventually.