• Post Reply Bookmark Topic Watch Topic
  • New Topic

Memory leak caused by JComboBox

 
hi ruben
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I encounter the same problem as blow:

" when opening the popup of the combobox. In our case, this means that everytime a
combobox is opened, the whole frame will not be garbage-collected, meaning that
virtually everything remains in memory."

This is a bug found in Sun's bug database.

the url is: http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4489211

Hope someone could help!

Thanks very much!
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to that this problem is almost four years old - and has been fixed in the later JDK versions. What version are you using? Can you post some code?
 
hi ruben
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much for your reply!

The JDK version is 1.4.2. Howerver, we do not use the original JComboBox. We extend it and add a tootip function( we named it "JTooltipCombobox"), then the problem happened.I can't post the code here, for it belongs to my company.

By using Jbuilder Profiler, I found that the moment we open the popup, the frame will have 3 more incoming references. And these reference can't be released even the frame closes. The 3 incoming references is about java.swing.popup ,java.swing.popupFactory and a hashtable. These refences prevent the frame being gabage collected.

This problem is really critical because we use lots of these JTooltipComboBox in our product.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Stewart points out, the bug you point to was fixed in 1.3.1_03, so it's not causing your leak. Now if the problem occurs in your extension of combo box but not in JComboBox, which is how you describe it, you can't blame the JDK for that. The problem must be in your code.
You limit the amount of aid we can give you if we can't view the code. Either get permission from your company to show us some code or work up a simple test case which exhibits the same behavior (the latter is actually preferable as we prefer SHORT code samples). Without some code to discuss we're just guessing at what the problem could be.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!