Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory consumption by the logging panel (disable undo events for it) #676

Merged
merged 1 commit into from Nov 4, 2021

Conversation

vlsi
Copy link
Collaborator

@vlsi vlsi commented Nov 4, 2021

Description

org.apache.jorphan.gui.ui.TextAreaUIWithUndo#createUI is called by Swing automatically by ALL text area components (since JMeter installs TextAreaUIWithUndo as a UI class for the look and feel).
That is convenient since it makes all text fields and text areas support undo transparently, however, it results in surprising memory consumption by the logging panel.

Here's a heap dump:
dominator tree

TextComponentUI$1 is UndoManager. I moved the anonymous class to a top-level named class so it is easier to understand in the future.

How Has This Been Tested?

Test plan with JSR223 sampler that calls log.info("...") a lot.
After the change, the undo manager and text area are no longer in the top consumers.

@vlsi vlsi force-pushed the logpanel_undo branch 2 times, most recently from cd0bc4e to 3543d86 Compare November 4, 2021 09:04
@FSchumacher
Copy link
Contributor

Cool

@vlsi vlsi force-pushed the logpanel_undo branch 2 times, most recently from e43fa9f to 062190a Compare November 4, 2021 17:09
…or it)

There are two fixes:
1) undoManager.setLimit(0) -> setLimit(1) since (0) means "unlimited undo"
See bobbylight/RSyntaxTextArea#99

2) By default, JMeter adds undoManager to ALL text fields via Swing updateUI method,
so we need to explicitly uninstall it for the case when undo is not needed
@vlsi vlsi merged commit 062190a into apache:master Nov 4, 2021
@vlsi vlsi deleted the logpanel_undo branch November 4, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants