I am using a simple ComboBox with BeanItemContainer:
List list = new LinkedList();
for(int i = 1; i < 300; i++){
list.add(new MemLeak(i));
}
BeanItemContainer memLeakContainer = new BeanItemContainer(MemLeak.class, list);
ComboBox memoryLeak = new ComboBox(“Memory Leak”, memLeakContainer);
memoryLeak.setItemCaptionPropertyId(“info”);
In my application I have combo boxes with 450 choices, so 300 is a possible value.
MemLeak is very simple class:
public class MemLeak {
private Integer integer;
private String string;
private Double double1;
public MemLeak(Integer integer) {
super();
this.integer = integer;
}
public String getInfo(){
return "Hey" + string + integer + double1;
}
}
I have found that the MemLeak objects are not freed from memory upon a page refresh (Ctrl+F5).
If I navigate to another page the objects get garbage collected, otherwise they remain on the heap.
I think this is might be a seriuos issue.
If I use IndexedContainer, the MemLeak objects get collected.
I am using Vaadin 7.0.3 with JBoss 4.2 (jrockit-jdk-1.6_29-R28.2.2/jrockit-jdk-1.6_37-R28.2.5). I have checked the heap with Mission Control. See the results in the attachment.