Why is there a memory leak when I repeatedly open and close my Java GUI objects in MATLAB 6.1 (R12.1) and later versions?
Show older comments
When I create and destroy a Java GUI object repeatedly, as in the following code:
for i=1:1000
f=javax.swing.JFrame('Test for Memory Leak');
f.getContentPane.add(javax.swing.JTextField('text'));
f.pack;
f.setVisible(true);
pause(1.);
f.dispose;
clear f;
end
Memory is consistently being leaked during each iteration.
Accepted Answer
More Answers (0)
Categories
Find more on Call Java from MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!