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

high memory consumption on 64-bit JVMs when managing swing-components [SPR-9628] #14262

Closed
spring-projects-issues opened this issue Jul 24, 2012 · 3 comments
Labels
in: core status: declined

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jul 24, 2012

mat rium opened SPR-9628 and commented

Hi,

i have been using spring for managing a swing-based client-application recently for the first time, and noticed some strange behaviour: On 64-Bit JVMs the application seems to eat up a lot more memory than expected (about 10 times the memory it uses on 32-Bit JVMs).

My application, which consists out of only 11 swing-components that are wired together with spring easily eats up 400MB memory. Even the most basic application (one JFrame and one JPanel that gets injected into that Frame) use up more than 150MB already. I will attach a simple test-project (just that 2 classes + applicationContext.xml + required libraries), so you can see for yourself.

In a memory dump you can see that a lot of java.lang.reflect.Method objects are created, maybe because JFrame (and other Swing Components) inherits like 100 methods or so? See the following answer on stackoverflow: http://stackoverflow.com/a/11620952/1164797 (forget/ignore the question itself though, initially i thought this is related to AnnotationConfigApplicationContext, which i now know is not the case).

I am not sure, maybe this is just expected because of the number of methods JFrame has? So this might not be a bug at all.. Still, 150MBs for 2 beans seems just unreasonable, doesn't it?


Affects: 3.1.2

Attachments:

1 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jul 24, 2012

mat rium commented

Forgot to mention that the performance is bad too, the initialization/refresh of the applicationcontext takes much longer than it does on 32-bit. Also this problem seems easily reproduceable on any machine/operating system we tested so far (win7, win server 2008, ubuntu, mac ox), as long as 64-bit JVM is used. With 32-Bit JVM everything seems all right, startup is really fast and the memory consumption is lower by a factor 5 to 10.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 4, 2012

Pavel Kotlov commented

Using Spring along with Swing seems not a good idea at all. If we cannot resolve the issue it would be great to know how someone can avoid this behavior.
->Removing Components extending JPanels or JFrames?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 27, 2018

Sébastien Deleuze commented

Closing groups of outdated issues. Please reopen if still relevant.

@spring-projects-issues spring-projects-issues added type: bug status: declined in: core and removed type: bug labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: declined
Projects
None yet
Development

No branches or pull requests

1 participant