ComboBox (possible) memory leak


I’ll try to discuss my issue with as much detail as possible. The vaadin version I am using is 6.7.3. I don’t think it is vaadin, maybe just how I am using it. Either way, I would like to try and figure out why its retaining combobox references in my code.

I have been running some regression tests on my application and as the number of requests from users grow, the larger the memory on my system grows and after a certain number of requests, Out Of Memory error occurs. I’ve attached some source that might help with a solution.

The test goes as follows:

  1. User 1 logs in.
  2. User opens a screen (Custom Component OrderDetailsWindow).
  3. Screen creates a form ( Form called DetailsForm with combo box 10,000 items).
  4. User updates form and submits to database.
  5. User closes screen.
  6. User logs out.

This goes on for 5 consecutive users, and runs about 1 transaction each user a minute, a total of about 5 transactions a minute.

In step 3, when the screen is created, I have a combobox that (would normally get information from the database, instead I changed for testing to just a for loop) adds 10,000 items. The combo box gets created for the form and then after closing the form, the 10,000 item combo box stays referenced in the application some how.

One thing I might be doing differently is I change the contents of the combobox when the user selects something. For example, a user select a different combo box item (location Hawaii) and I populate another combo with companies in that Hawaii:


CbnComboBox comboBoxReg = (CbnComboBox) [b]
			HashMap<String,Object> hashMap = new HashMap<>();

			comboBoxReg.load(CbnComboBox.TYPE_LOCATION, hashMap);


public void load(Integer type, HashMap<String, Object> hashMap)
		for(int i=0; i < 10000; ++i){
			setItemCaption(i, "Reg1");
	} (1.64 KB) (1.82 KB) (9.35 KB)

I have found out that it has to do with sessions of users. How does vaadin handle user sessions once they have logged out or closed their browser?

For anyone wondering… yes I did solve the issue. The server was keeping the user sessions open for a 5 minutes after they were finished the transactions. Each transaction became a new session, and presto… too much memory usage.