Name: gm110360 Date: 04/11/2002
FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000
[Version 5.00.2195] Service Pack 2 Build 2195
EXTRA RELEVANT SYSTEM CONFIGURATION :
C Drive Free space 120MB
RAM: 326,192KB
A DESCRIPTION OF THE PROBLEM :
I had created a small program to draw shapes and create
images. It was working fine on jdk 1.3.1. The sample
program that i have attached works on 1.3.1 with following
resource usage:
52% - 90% - 10% - 00% CPU usage
8,292K Memory
On jdk 1.4.0 it gives a OutofMemory Exception after using:
55% - 90% - 99% CPU
74,764K Memory
I found the problem is in the clip() method.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. javac Test.java
2. java Test
3. Check Memory and CPU Usage
4. Compare it with jdk 1.3.1
EXPECTED VERSUS ACTUAL BEHAVIOR :
I expect it to take very less resources as in jdk 1.3.1
The results i saw: In a system having low virtual memory
you get java.lang.OutOfMemoryError
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.OutOfMemoryError
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.geom.*;
public class Test extends Frame {
public Test() {
super("Test");
setSize(300,300);
show();
}
public static void main(String args[]) {
Test t = new Test();
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
float dash[] = new float[2];
dash[0] = 3.0f;
dash[1] = 7.0f;
Rectangle2D r = new Rectangle2D.Double(25,25,200,200);
Stroke s = new BasicStroke
(5,BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND,1.0f,dash,1.0f);
Shape border = s.createStrokedShape(r);
Area clip1 = new Area(r);
clip1.subtract(new Area(border));
g2.clip(clip1);
g2.setPaint(Color.red);
g2.fill(clip1);
g2.translate(25,25);
Rectangle2D r2 = new Rectangle2D.Double(0,0,300,300);
border = s.createStrokedShape(r2);
clip1 = new Area(r2);
clip1.subtract(new Area(border));
g2.clip(clip1);
g2.setPaint(Color.blue);
g2.fill(clip1); /* <- OutofMemory */
}
}
---------- END SOURCE ----------
Release Regression From : 1.3.1_03
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 144890)
======================================================================