Article View: borland.public.jbuilder.java.swing
Article #12521Re: Memory leak with Jdk 1.2
From: Richard Wilkman
Date: Thu, 17 Dec 1998 00:00
Date: Thu, 17 Dec 1998 00:00
100 lines
3987 bytes
3987 bytes
Benoit:
Perhaps you should submit it as a bug at JDC (though glancing at your
code I can't find where the last references would ever get dropped)?
As long as you are not using IE+Active Desktop or Win98, you could
have a legit bug. If you are using those items it's closer to "as
designed". In those cases, exiting IE just shuts off the browser
front end. All the guts (include any applet that didn't handle
stop()) continues to run. That would look like a memory leak.
-Rich
Benoit Sibold wrote:
>
> We have developped a big applet(product) with Jdk 1.2 (Swing 1.1)
> with a lot of JInternal Frame. As we open the JInternal Frame and
> close them : THE MEMORY IS NEVER RELEASED and raises therefore.
> We must close Netscape and rerun the applet all 5mn
>
> There is a sample applet code there show the problem using jdk 1.2
>
> package untitled12;
>
> import java.awt.*;
> import java.awt.event.*;
> import java.applet.*;
>
> public class Test extends JApplet {
> boolean isStandalone = false;
> int counter = 1;
> JButton makeButton = new JButton("Make");
> JButton clearButton = new JButton("Clear");
> JPanel buttonPanel = new JPanel();
> JDesktopPane displayPanel = new JDesktopPane();
>
> public Test() {
> }
> public void init() {
> try {
> jbInit();
> }
> catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> private void jbInit() throws Exception {
> this.setSize(400, 300);
> this.getContentPane().setLayout(new BorderLayout());
> makeButton.addActionListener(new java.awt.event.ActionListener() {
> public void actionPerformed(ActionEvent e) {
> button_actionPerformed(e);
> }
> });
> clearButton.addActionListener(new java.awt.event.ActionListener() {
> public void actionPerformed(ActionEvent e) {
> clearButton_actionPerformed(e);
> }
> });
> this.getContentPane().add(buttonPanel, BorderLayout.NORTH);
> this.getContentPane().add(displayPanel, BorderLayout.CENTER);
> buttonPanel.setLayout(new BorderLayout());
> buttonPanel.add(makeButton, BorderLayout.WEST);
> buttonPanel.add(clearButton, BorderLayout.EAST);
> }
> void button_actionPerformed(ActionEvent e) {
> for (int i = 0; i <= 9; i++) {
> JInternalFrame frame = new JInternalFrame("Frame #" + counter++, false,
> false, false, false);
> JButton frameButton = new JButton("Frame button");
> frame.getContentPane().add(frameButton);
> displayPanel.add(frame);
> frame.pack();
> frame.show();
> }
> }
>
> void clearButton_actionPerformed(ActionEvent e) {
> JInternalFrame list[] = displayPanel.getAllFrames();
> for (int i = 0; i < list.length; i++)
> list[i].dispose();
> displayPanel.repaint();
> counter = 1;
> }
> }
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team
If you see something that looks like an opinion up there,
it's mine and mine alone.
Mail sent to me from the newsgroups won't bounce but will
be ignored. If I have time, I'll respond, but you have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID:
<36792947.56433D3D@inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<367632FD.E9919BD7@advs2.gm.fh-koeln.de> <3676914E.9874CD28@inprise.com> <3678D60A.54CFEE98@mhinformatics.ch>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a03ec11fedbe6399 X-Google-Attributes: gid111d45,public From: Richard Wilkman <rwilkman@inprise.com> Subject: Re: Memory leak with Jdk 1.2 Date: 1998/12/17 Message-ID: <36792947.56433D3D@inprise.com> X-Deja-AN: 423283539 Content-Transfer-Encoding: 7bit References: <367632FD.E9919BD7@advs2.gm.fh-koeln.de> <3676914E.9874CD28@inprise.com> <3678D60A.54CFEE98@mhinformatics.ch> Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing