You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there,
first thank you for this nice and simple library!
I am facing an issue where my commands hold references to data structures that take up a fair bit of RAM. When I ran into memory limit issues, I debugged my application and ran into the following culprit:
After publishing lots of commands that reference huge amounts of RAM, I publish one command that is not undoable. As a consequence, the undo stack is cleared and I would expect that the commands that were in the undo stack are deallocated and can thus be picked up by the garbage collector. This, however is not the case, as private final SortedSet<ExecutionRecord> executionRecords in CommandDelegator.java keeps references to all commands ever executed, even after the undo stack is cleared.
I understand that the execution record mechanism can be useful, but in my case, it causes a memory leak. My suggestion would therefore be to make it optional or at least have the option to clear it.
Cheers :)
The text was updated successfully, but these errors were encountered:
vatbub
pushed a commit
to vatbub/re-agent
that referenced
this issue
Nov 15, 2022
I just realized while testing that disabling the mechanism and thus disabling the listener mechanism as well might not be such a good idea. I decided to create a private fork where I removed CommandDelegator.executionRecords and CommandDelegator.getExecutionRecords(). This way, the memory leak is fixed while keeping the listeners working. This would be a breaking api change though, which is why I decided to not include that in my PR.
Cheers :)
Hi there,
first thank you for this nice and simple library!
I am facing an issue where my commands hold references to data structures that take up a fair bit of RAM. When I ran into memory limit issues, I debugged my application and ran into the following culprit:
After publishing lots of commands that reference huge amounts of RAM, I publish one command that is not undoable. As a consequence, the undo stack is cleared and I would expect that the commands that were in the undo stack are deallocated and can thus be picked up by the garbage collector. This, however is not the case, as
private final SortedSet<ExecutionRecord> executionRecords
inCommandDelegator.java
keeps references to all commands ever executed, even after the undo stack is cleared.I understand that the execution record mechanism can be useful, but in my case, it causes a memory leak. My suggestion would therefore be to make it optional or at least have the option to clear it.
Cheers :)
The text was updated successfully, but these errors were encountered: