-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
x86
-
windows_xp
Name: rmT116609 Date: 09/27/2004
FULL PRODUCT VERSION :
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Create a simple JFrame application:
public class SimplerFrame extends javax.swing.JFrame
{
public static void main(String args[])
{
SimplerFrame Sf = new SimplerFrame();
Sf.setSize(800, 600);
Sf.setTitle("Simple Frame");
Sf.setDefaultCloseOperation(Sf.EXIT_ON_CLOSE);
Sf.setVisible(true);
}
}
Run the application and look at the corresponding java.exe process in TaskManager. TaskManager reports that the application is using at least 13MB of memory.
Create a "Single Document" MFC application, using the "wizard" in Visual Studio. I used static linking to MFC. Run the application. TaskManager reports that the application is using only 3MB of memory. Why? I understand that the JRE has to load classes and intialize some things but 4 times the RAM VS C++ to make a simple window?
If you actually start to add more functionality to the window (toolbars, menus, etc.) the memory usage only gets worse. The heap size in java.lang.Runtime seems to have nothing to do with the JRE process size. My application can have 8MB of RAM on the heap but a 23MB process size.
Please fix this or at least explain in detail what is going on. The way it appears to most developers and customers is that Java is a memory hog and is somehow inefficient. There may be perfectly good reasons for the JREs behavior but I think the developer community needs an explanation.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See Description section.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would hope that the JRE would use 30% more RAM than it's C++/native counterpart. At this point at would settle for 100%. It would be an improvement over 400%.
ACTUAL -
See description.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class SimplerFrame extends javax.swing.JFrame
{
public static void main(String args[])
{
SimplerFrame Sf = new SimplerFrame();
Sf.setSize(800, 600);
Sf.setTitle("Simple Frame");
Sf.setDefaultCloseOperation(Sf.EXIT_ON_CLOSE);
Sf.setVisible(true);
}
}
---------- END SOURCE ----------
(Incident Review ID: 311742)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Create a simple JFrame application:
public class SimplerFrame extends javax.swing.JFrame
{
public static void main(String args[])
{
SimplerFrame Sf = new SimplerFrame();
Sf.setSize(800, 600);
Sf.setTitle("Simple Frame");
Sf.setDefaultCloseOperation(Sf.EXIT_ON_CLOSE);
Sf.setVisible(true);
}
}
Run the application and look at the corresponding java.exe process in TaskManager. TaskManager reports that the application is using at least 13MB of memory.
Create a "Single Document" MFC application, using the "wizard" in Visual Studio. I used static linking to MFC. Run the application. TaskManager reports that the application is using only 3MB of memory. Why? I understand that the JRE has to load classes and intialize some things but 4 times the RAM VS C++ to make a simple window?
If you actually start to add more functionality to the window (toolbars, menus, etc.) the memory usage only gets worse. The heap size in java.lang.Runtime seems to have nothing to do with the JRE process size. My application can have 8MB of RAM on the heap but a 23MB process size.
Please fix this or at least explain in detail what is going on. The way it appears to most developers and customers is that Java is a memory hog and is somehow inefficient. There may be perfectly good reasons for the JREs behavior but I think the developer community needs an explanation.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See Description section.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I would hope that the JRE would use 30% more RAM than it's C++/native counterpart. At this point at would settle for 100%. It would be an improvement over 400%.
ACTUAL -
See description.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class SimplerFrame extends javax.swing.JFrame
{
public static void main(String args[])
{
SimplerFrame Sf = new SimplerFrame();
Sf.setSize(800, 600);
Sf.setTitle("Simple Frame");
Sf.setDefaultCloseOperation(Sf.EXIT_ON_CLOSE);
Sf.setVisible(true);
}
}
---------- END SOURCE ----------
(Incident Review ID: 311742)
======================================================================