|
Preview: TeamDev Support: Message List - JExplorer Demo & Samples
TeamDev Support: Message List - JExplorer Demo & SamplesMost recent forum messagesPublished: Mon, 25 May 2009 11:23:16 GMT2009-05-25T11:23:16Z
Re: Memory issue after closing a browser window Mon, 25 May 2009 11:23:15 GMT2009-05-25T11:23:15Z Hi Navin, It seems like the reason in BrowserPanel.close method. Please try to change this method on the following: This solution solves the issue. Regards, Vladimir Ikryanov
Re: Memory issue after closing a browser window Fri, 22 May 2009 20:55:41 GMT2009-05-22T20:55:41Z Hi Navin, I have tried your sample and I'm able to reproduce this issue. This is actually a bug in JExplorer. Thanks for reporting it. I will look at this problem and let you know the results soon. Regards, Vladimir Ikryanov
Re: Memory issue after closing a browser window Fri, 22 May 2009 17:13:43 GMT2009-05-22T17:13:43Z Valdimir,
I do call the close() method of Browser in BrowserCloseListener which is a WindowListener. In the memory profiler I see reference of the window that contains the Browser panel remaining after I click the "X" button.
Re: Memory issue after closing a browser window Fri, 22 May 2009 15:54:09 GMT2009-05-22T15:54:09Z Hi Navin, To dispose a WebBrowser instance you need just to invoke the WebBrowser.close method. About this issue, could you please provide me more information about the reference you may see after disposing Browser instance? Regards, Vladimir Ikryanov
Re: Memory issue after closing a browser window Fri, 22 May 2009 15:35:53 GMT2009-05-22T15:35:53Z Ok, below are the two sample files to reproduce it. Also from the profiles it seems there is HashMap that is holding onto the parent window somewhere in "com.jniwrapper.win32.ie.di".package test;import com.jniwrapper.win32.ie.Browser;import com.jniwrapper.win32.ie.WebBrowser;import com.jniwrapper.win32.ie.event.NewWindowEventListener;import javax.swing.JPanel;import java.awt.BorderLayout;import java.awt.Container;import java.awt.Rectangle;public class BrowserPanel extends JPanel { public static final int DEFAULT_BROWSER_WIDTH = 925; public static final int DEFAULT_BROWSER_HEIGHT = 600; protected final Browser browser; public BrowserPanel() {   setLayout(new BorderLayout());   browser = new Browser();   browser.setSilent(true); // suppress the javascript error dialog   // add listener for child window   browser.addNewWindowListener(new NewWindowEventListener() {     public void windowOpened(WebBrowser webBrowser) {       Container ancestor = ((Browser) webBrowser).getTopLevelAncestor();       Rectangle rectangle = browser.getBounds();       ancestor.setBounds(rectangle.x + 10 , rectangle.y + 10, DEFAULT_BROWSER_WIDTH, DEFAULT_BROWSER_HEIGHT);       ancestor.validate();     }   });   add(browser, BorderLayout.CENTER); } public void load(String urlString) {   try {     browser.navigate(urlString);   } catch (Exception e) {     throw new RuntimeException(e);   } } public void close() {   browser.close(); }}-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------package test;import javax.swing.JFrame;import javax.swing.SwingUtilities;import javax.swing.JButton;import java.awt.Frame;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;public class BrowserWindowTest extends JFrame { private final BrowserPanel browserPanel; public BrowserWindowTest() {   browserPanel = new BrowserPanel();   setTitle("browser test");   add(browserPanel);   browserPanel.load("http://www.google.com");   setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);   addWindowListener(new BrowserCloseListener()); } private class BrowserCloseListener extends WindowAdapter {   @Override   public void windowClosed(WindowEvent e) {                                     browserPanel.close();     System.gc(); // just for heck of it     System.out.println("size ===" + Frame.getFrames().length); // the number of frames keep increasing and never goes down.   } } public static void main(String[] args) {   SwingUtilities.invokeLater(new Runnable() {     @Override     public void run() {       JFrame frame = new JFrame("test");       JButton button = new JButton("open browser");       button.addActionListener(new ActionListener() {         @Override         public void actionPerformed(ActionEvent e) {           System.gc();           BrowserWindowTest embeddedBrowserWindow = new BrowserWindowTest();           embeddedBrowserWindow.setSize(400, 400);           embeddedBrowserWindow.setVisible(true);         }       });       frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);       frame.add(button);       frame.setSize(300, 300);       frame.setVisible(true);     }   }); }} [...]
Memory issue after closing a browser window Fri, 22 May 2009 14:07:25 GMT2009-05-22T14:07:25Z I attach the browser window to a JFrame have its default operation set to dispose_on_close. When I close the window I still see that someone is holding on to the reference. I do call Borwser.close() in WindowClosed(...) event inside a WindowListener I have attached to the JFrame. Do I need to do something else? I used a profiler to see no one outside is holding on to a reference.
Re: Problem with Maximized browser Mon, 11 May 2009 21:25:46 GMT2009-05-11T21:25:46Z Vladimir, Please let me know when you have a solution or workaround. Thanks, Navin
Re: Problem with Maximized browser Fri, 08 May 2009 16:57:13 GMT2009-05-08T16:57:13Z Hi, I cannot suggest you a workaround right now Regards, Vladimir Ikryanov
Re: Problem with Maximized browser Fri, 08 May 2009 13:52:28 GMT2009-05-08T13:52:28Z Vladimir,
Can you suggest a workaournd for now? I am thinking if I just catch window resize events and repaint the whole thing it should work. What do you think? Also when do you think we will get the fix :-)
Re: Problem with Maximized browser Fri, 08 May 2009 13:31:29 GMT2009-05-08T13:31:29Z Hi Navin, Thanks for the sample. I'm able to reproduce this issue with your sample. In one of the following version of JExplorer we will fix this issue. Regards, Vladimir Ikryanov |
||||||