Running this program on Hotspot/SE-E compared to CDC shows that CDC can load Java classes in 50% less memory. This RFE is used to track the invesigation into why this is occuring. I modified the Hotspot VM to not parse and load the Line Number Information but this only saved 1M out of the total 74M on Linux/x86 systems.
Here's the RSS that I saw when running this test program on the entire rt.jar class list.
CVM/CDC6 43152K
Hotspot 74456k
import java.lang.*;
import java.io.*;
import java.util.*;
public class LoadClassesFromList {
static String loadFileName;
public static void main(String[] args) {
loadFileName = args[0];
loadClassesFromFileList();
System.out.println("Doing GC Before Exit\n");
System.gc();
System.out.println("waiting for exit: ");
try {
Thread.sleep(30000L);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void loadClassesFromFileList()
{
String str;
try {
BufferedReader in =
new BufferedReader(new FileReader(loadFileName));
while ((str = in.readLine()) != null) {
try {
Class clz = Class.forName(str, false, null);
//System.out.println("class loaded: " + clz);
} catch (Throwable ee) {
System.out.println(ee.toString());
}
}
in.close();
} catch (Exception ee) {
ee.printStackTrace();
}
}
}
Here's the RSS that I saw when running this test program on the entire rt.jar class list.
CVM/CDC6 43152K
Hotspot 74456k
import java.lang.*;
import java.io.*;
import java.util.*;
public class LoadClassesFromList {
static String loadFileName;
public static void main(String[] args) {
loadFileName = args[0];
loadClassesFromFileList();
System.out.println("Doing GC Before Exit\n");
System.gc();
System.out.println("waiting for exit: ");
try {
Thread.sleep(30000L);
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void loadClassesFromFileList()
{
String str;
try {
BufferedReader in =
new BufferedReader(new FileReader(loadFileName));
while ((str = in.readLine()) != null) {
try {
Class clz = Class.forName(str, false, null);
//System.out.println("class loaded: " + clz);
} catch (Throwable ee) {
System.out.println(ee.toString());
}
}
in.close();
} catch (Exception ee) {
ee.printStackTrace();
}
}
}