When executing customer's app (which is a plant/factory automation application) in a stress test, a major native memory leak is observed.
A stress test is using application functionality that causes a new applet to be launched and closed in a repeated fashion. In such configuration a new applet is launched/closed approx. every 10 seconds.
After the application runs for approx. 1 day, the virtual memory used by the iexplore.exe process grows to approx. 500 MB and the page file size grows to approx. 700 MB. At this point, the application typically crashes at some random point.
The crashes could be in various places, but most of them happen during the malloc() call.
The easiest way to alleviate the customer's issue is to eliminate the native memory leak.
Minimized test case:
modify Launcher.java below with the location of the JDK 5.0 path (which includes the demo directory): <PATH_TO_JDK5.0>. Copy launcher.java, launcher.html to the demo\applets\ArcTest directory. Compile.
Run launcher.html below in IE. Press the "launch" button. It will launch the ArcTest Demo in another window. Once loaded, close the ArcTest IE window. Press "launch" button again. Repeat multiple times.
You can observe a native memory leak in the iexplore.exe process. The test can be automated with a native robotic tool. After running 1 day the iexplore.exe process either hangs or crashes. The native memory usage reaches anout 1.3 Gb.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.net.*;
Launcher.java :
public class Launcher extends Applet implements ActionListener {
public void init() {
Button b = new Button("Launch");
b.addActionListener(this);
add(b);
}
public void processEvent(AWTEvent e) {
if (e.getID() == Event.WINDOW_DESTROY) {
System.exit(0);
}
}
public void actionPerformed(ActionEvent ev) {
try {
getAppletContext().showDocument(new URL("file:///<PATH_TO_JDK5.0>\\demo\\applets\\ArcTest\\example1.html"), "_blank");
} catch (Exception e) {
System.out.println("Exc : " + e);
}
}
}
launcher.html :
<html>
<head>
<title>Arc Test Launcher</title>
</head>
<body>
<h1>Arc Test Launcher</h1>
<hr>
<applet code=Launcher.class width=400 height=400>
alt="Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
Your browser is completely ignoring the <APPLET> tag!
</applet>
<hr>
<a href="Launcher.java">The source</a>.
</body>
</html>
###@###.### 2004-12-06 20:30:16 GMT
###@###.### 2004-12-09 20:36:47 GMT
The small test case above was run under Numega BoundsChecker (about 50 iterations, system crashes if more iterations are preformed).
The boundschecker memory leak report is attached to this report: iexplore5.bce ). It gives some clues for the problem areas.
Please note that J2SE was not instrumented with boundschecker, so the information in the report is not 100% complete. J2SE doesn't compile correctly with boundschecker's compiler which is required to instrument the binary
###@###.### 2004-12-20 00:08:08 GMT
The above mentioned test was modified to remove all the AWT functionality from ArcTest.java. Still significant native leak is observed. This proves that plugin itself does make a significant contribution to the memory leak. The boundschecker report when running in this way is attached also.
###@###.### 2004-12-21 21:47:23 GMT