|A way to reduce memory cost during create diagram [message #1779440]
||Mon, 08 January 2018 03:49
| mind calm
Registered: July 2017
As mentioned in another topic, https://www.eclipse.org/forums/index.php/m/1775006/ , i was found memory grows in speed of O(n²) by model size. Now i have a way to fix it.
In function DiagramDialectServices.createRepresentation(),
before canonicalSynchronizer.synchronize(), we can remove the TransactionChangeRecorder from gmfDiag.eAdapters(). After canonicalSynchronizer.synchronize(), we add the TransactionChangeRecorder back.
The TransactionChangeRecorder is used for undo/redo, during create representation, each creation of a nodeImpl will trigger TransactionChangeRecorder to create a FeatureChangImpl for recording the value before create this nodeImpl, so the memory grows in O(n²).
As my test, the memory sharply reduced while the model size is huge. But i don't know whether the modification brings other potential issues.
In my opinion, the representation creation can not be undo is acceptable.
by Keep Mind Calm
Powered by FUDForum
. Page generated in 0.02802 seconds