Runtime compilation problem with java7
Since switching from Java 6 to Java 7 our application's memory foot print has increased significantly. Diagnosing the problem lead us to the java compiler. Our application generates, compiles and accesses source code at run-time via the JSR-000199 compiler API. We create a new instance of the compiler and class loader for every compilation, which may be sub-optimal but that is the way it is for now.
The behaviour we observer is:
in Java 6 our application uses under 300MB of memory and runs consistent.
in Java 7 the application uses as much memory as is available, plus a little bit extra outside the heap. For example on a 7.5GB heap on a 8GB system, the java process is killed by oom-killer after allocating over 8.8GB (8GB physical +1 GB swap).
The main object using up the space is the SharedNameTable object. One of the theories we were throwing around was that between Java 6 to Java 7 a week reference was changed to a soft reference, resulting in object being kept in memory for longer.
We are looking for any pointers which could explain our observation and maybe even some suggested option to get Java 7 to free up resources and utilise less memory. I fully appreciate that what we are doing is quite non-standard and would like to avoid getting into the reasons of how we got there.
The reason oom-killer kills my java process is because the process is using more than all the available memory. The system has got 8GB or RAM and 1GB of swap space. I set the heap to 7.5GB and 256MB permgen, leaving me with 256MB for the OS and 1GB of swap space for just in case. I appreciate the Java process will allocate more than the heap and permgen combined, but I didn't expect it to go over by 1.3 GB. Shortly before oom-killer did its job the java process was using around 8.8GB.
Maybe you can shed some light on how best to size the heap in this configuration.
Similar Messages
-
Compilation problem with templates while using option -m64
Hi,
I have compilation problem with template while using option -m64.
No problem while using option -m32.
@ uname -a
SunOS snt5010 5.10 Generic_127111-11 sun4v sparc SUNW,SPARC-Enterprise-T5220
$ CC -V
CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25
Here is some C++ program
############# foo5.cpp #############
template <typename T, T N, unsigned long S = sizeof(T) * 8>
struct static_number_of_ones
static const T m_value = static_number_of_ones<T, N, S - 1>::m_value >> 1;
static const unsigned long m_count = static_number_of_ones<T, N, S - 1>::m_count + (static_number_of_ones<T, N, S - 1>::m_value & 0x1);
template <typename T, T N>
struct static_number_of_ones<T, N, 0>
static const T m_value = N;
static const unsigned long m_count = 0;
template <typename T, T N>
struct static_is_power_of_2
static const bool m_result = (static_number_of_ones<T,N>::m_count == 1);
template <unsigned long N>
struct static_number_is_power_of_2
static const bool m_result = (static_number_of_ones<unsigned long, N>::m_count == 1);
int main(int argc)
int ret = 0;
if (argc > 1)
ret += static_is_power_of_2<unsigned short, 16>::m_result;
ret += static_is_power_of_2<unsigned int, 16>::m_result;
ret += static_is_power_of_2<unsigned long, 16>::m_result;
ret += static_number_is_power_of_2<16>::m_result;
else
ret += static_is_power_of_2<unsigned short, 17>::m_result;
ret += static_is_power_of_2<unsigned int, 17>::m_result;
ret += static_is_power_of_2<unsigned long, 17>::m_result;
ret += static_number_is_power_of_2<17>::m_result;
return ret;
Compiation:
@ CC -m32 foo5.cpp
// No problem
@ CC -m64 foo5.cpp
"foo5.cpp", line 20: Error: An integer constant expression is required here.
"foo5.cpp", line 36: Where: While specializing "static_is_power_of_2<unsigned long, 16>".
"foo5.cpp", line 36: Where: Specialized in non-template code.
"foo5.cpp", line 26: Error: An integer constant expression is required here.
"foo5.cpp", line 37: Where: While specializing "static_number_is_power_of_2<16>".
"foo5.cpp", line 37: Where: Specialized in non-template code.
"foo5.cpp", line 20: Error: An integer constant expression is required here.
"foo5.cpp", line 43: Where: While specializing "static_is_power_of_2<unsigned long, 17>".
"foo5.cpp", line 43: Where: Specialized in non-template code.
"foo5.cpp", line 26: Error: An integer constant expression is required here.
"foo5.cpp", line 44: Where: While specializing "static_number_is_power_of_2<17>".
"foo5.cpp", line 44: Where: Specialized in non-template code.
4 Error(s) detected.
Predefined macro:
@ CC -m32 -xdumpmacros=defs foo5.cpp | & tee log32
@ CC -m64 -xdumpmacros=defs foo5.cpp | & tee log64
@ diff log32 log64
7c7
< #define __TIME__ "09:24:58"
#define __TIME__ "09:25:38"20c20
< #define __sparcv8plus 1
#define __sparcv9 1[snipped]
=========================
What is wrong?
Thanks,
Alex VinokurBug 6749491 has been filed for this problem. It will be visible at [http://bugs.sun.com] in a day or two.
If you have a service contract with Sun, you can ask to have this bug's priority raised, and get a pre-release version of a compiler patch that fixes the problem.
Otherwise, you can check for new patches from time to time at
[http://developers.sun.com/sunstudio/downloads/patches/]
and see whether this bug is listed as fixed. -
Revision: 11707
Author: [email protected]
Date: 2009-11-12 10:52:49 -0800 (Thu, 12 Nov 2009)
Log Message:
Fix incremental compilation problem with styles.
QE notes: None.
Doc notes: None.
Bugs: SDK-24173
Reviewer: Paul
Tests run: checkintests
Is noteworthy for integration: No.
Ticket Links:
http://bugs.adobe.com/jira/browse/SDK-24173
Modified Paths:
flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.javaYou have used elements like header, footer, footer1 and nav without using the correct DOCTYPE declaration. Replace the first line of your code with
<!doctype html>
Also have a look here for other problems http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fhome.surewest.net%2Fstorytales%2F test%2Fforposting.html
After the above has been fixed, please come back here to fix the remaining problem(s)
Gramps -
Compile problem with javax.sql
I have upgraded to sdk 1.4.2 and tried to compile my code. I am getting an error on import javax.sql.* where I am getting the message "Package does not exist" error. As the result of this any class that is in this package gets an error as well. I am using ant to do the build. It does not seem to have a problem with the other import files and some of my code do compile fine except for this one that contains javax.sql.*. Thanks for your help.
Are you sure that the javax.sql.* stuff exists in your javac classpath? It seems not to be there. Look for j2ee.jar (from Sun J2EE SDK), or something like that (something like it probably came with your app server).
Mike -
Compiler Problem with double. Need Help
Hello,
I am having a problem with WorkShop Compilers 5.0 98/12/15 C++ 5.0. There is a problem with declaring double inside a nested class which is nested 3 times. Below is the code what shows the problem. If you have Workshop 5.0 please cut and paste the program below and do a simple cc <filename> compile. Run it and you should see the problem.
---------------------------cut----------------------------
#include <stdio.h>
class myclass3
public:
myclass3() {}
~myclass3() {}
short aaa;
int bbb;
double ccc;
char ddd;
class myclass2
public:
myclass2() {}
~myclass2() {}
short aaa;
int bbb;
double ccc;
char ddd;
myclass3 m_myclass3[50];
class myclass
public:
myclass() {}
~myclass() {}
int a;
char b;
float c;
short aa;
double bb;
myclass2 m_myclass2;
int main()
myclass m_myclass;
m_myclass.m_myclass2.m_myclass3[1].ccc = 11111.1111;
printf("<%f>\n",m_myclass.m_myclass2.m_myclass3[1].ccc);
return 0;
---------------------------cut----------------------------
The result I get on my machine is
<-3100025845628125216032986949222617505819484589120973946744108811398502585541238252995581839380933130321904775653231251529249013141831370896782391931299571941247444654355877793201472387703486841059940760873131775588361546584668766208.000000>
This is definitly incorrect. Does anyone have this problem? Is this a compiler bug? If you figure it out please email me at [email protected]
Thanks
Salman AhmadSalman - I tested your program on an up to date version of the C++
5.0 compiler and received the following results:
a.out<11111.111100>
That is what I would expect...
Have you installed all of the patches for the 5.0 compiler? It is
possible that this problem was found and fixed.
The current basic patchid's for CC 5.0 on sparc are: 107311-12, 107357-11, and the libC patch for your version of the OS. -
JSP Compilation Problems With JSTL tags
My JSP worked well when I used JSP expressions, scriptlets, .... I tried to use JSTL instead and encountered some compilation problems. I am unable to see my mistakes and need help:
Problme #1:
int offset = 0;
try
<c:set var="offset" value="${requestScope.offset}" />
catch ( Exception e )
// do nothing
}The above code has two compilation errors:
Generated servlet error:
[javac] Compiling 1 source file
illegal start of expression
<c:set var="offset" value="${requestScope.offset}" />
^
Generated servlet error:
';' expected
<c:set var="offset" value="${requestScope.offset}" />
^
Problem #2:
<c:set var="threadBean" value="${requestScope.ThreadBean}" />
int threadID_int = ParamUtil.getParameterInt( request, "thread" );
<c:if test="${threadBean.threadID} != threadID_int">
throw new AssertionException( "The two threadID are not the same." );
</c:if>Generated servlet error:
illegal start of expression
<c:if test="${threadBean.threadID != threadID_int}">
^I have deleted the Java code around the JSTL tags. Now, what is wrong with this <c:if test=" ... "> tag? It seems that I have problems to get JSTL tags right.
It seems that I have problems to get JSTL tags right....
<c:if test="${attachBean.attachMimeType.startsWith('image/')}">
<html:img page="getattachment?attach=<c:out value='${attachBean.attachID}' />" alt="<c:out value='${attachBean.attachFilename}' />" title="<c:out value='${attachBean.attachFilename}' />" border="0" />
</c:if>error message:
74: tag = 'if' / attribute = 'test': An error occurred while parsing custom action attribute "test" with value "${attachBean.attachMimeType.startsWith('image/')}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"] -
4D Runtime 2004 - problems with Leopard
I have major problems with 4D Runtime 2004 on Leopard.
Does anybody know if/when 4D (2004) will be compatible with Leopard ?Its easy to blame OS X without giving a reason why - in cases like this the easiest thing to do is to lay the blame at the feet of OS X without any substantiation.
Is your OS fully updated or are are there further updates you can download? There may be, for example a keyboard firmware update you need to install.
There may also be some updates for Office you can install.
Also bear in mind that Office 2004 is not Intel native and uses [Rosetta Emulation|http://www.apple.com/rosetta>. Upgrading to Office 2008 may also be worth considering as it is Intel ready. -
Runtime.exec() problem with Linux
Hi All,
I have a java program which I am using to launch java programs on all platforms.
I am using the Runtime.exec() method to start the process in a separate JVM.
But, I had a problem with the -classpath switch if the directories contained spaces. So I modified the java command which I am passing to the exec() method to something like:
java -classpath \"./my dir with spaces\" com.harshal.MainThis I had to do because of the problem in windows. But, if I use double quotes in Linux (for the classpath switch in my exec() method), it won't work.
Can anyone correct me so that I can use the Runtime.exec() method on all platforms to launch the java application even if the classpath directories contains spaces.
Thank you very much.I was reading about the command line args on java's
tutorial and I found a shocking news. Mac OS doesn't
support command line args, That's news to me. Could you please elaborate ?
More important is: I got it working. I figured out I had forgotten to try something before, or, to be more correct, I made an error when trying malcommc's envp suggestion: I used "classpath" as key, not "CLASSPATH", as it should have been.
Ran a new test, got it working.
Sample:
Given a rootdir. Subdirectory "cp test" with a classfile (named "test") without package declaration. Running another class in another directory, using:
String[] cmd = new String[]{
"java", "test"
String[] envp = new String[]{
"CLASSPATH=rootdir:rootdir/cp test" // <-- without quotes.
Runtime.getRuntime().exec(cmd, envp);It's been my wrong all the time. I didn't check hard enough. It simply had to work somehow (that's the kind of things that's easy to say afterwards :-)). -
Compiling problem with 1.4
my code is compiling well in 1.3 and the same is giving error if i compile with 1.4 compiler. pls help me out. here is the sample code which compiles fine with 1.3 and gives error in 1.4.
String lv_str_AdvPay = (String).valueOf(lv_db_AdvPay);
-atthulurimy code is compiling well in 1.3 and the same is
giving error if i compile with 1.4 compiler. pls help
me out. here is the sample code which compiles fine
with 1.3 and gives error in 1.4.
String lv_str_AdvPay =
(String).valueOf(lv_db_AdvPay);What's the error message? And what's the context of the code - what type is lv_db_AdvPay?
Regards,
Bhaveet -
Compiling Problem With Command Line
I am facing problem to compile the following class:
the error code is Like the following :
Sorry, I was trying to understand the members of a class declaration
but I got confused when I saw 'var' which is a keyword.var city: String;
{color:#ff0000}class Address {
var city: String;
}{color}
But when i compile the following class there was no error.
{color:#339966}class Address {
attribute city: String;
}{color}
Ok I consider that it takes attribute key word.
But in NetBeans 6.5 The following code is OK
{color:#339966}class Address {
var city: String;
}{color}
Could Any One tell me where is the problem.
With Best Regards
A S M Russel.
Edited by: Russel8930 on Dec 9, 2008 2:25 PM
Edited by: Russel8930 on Dec 9, 2008 2:28 PMYou have two different versions of the compiler on your machine. The right syntax is the one with the var-keyword.
-
Sun ejb tutorial compilation problem with sample code
I have been trying to follow the ejb tutorial off of Sun's web site. However, I get the following problem when I try to compile the sample code.
prompt>javac Demo.java
works fine
Prompt>javac DemoBean.java
works fine
Prompt>javac DemoHome.java
DemoHome.java:23: cannot resolve symbol
symbol : class Demo
location: interface ejb.demo.DemoHome
public Demo create() throws CreateException, RemoteException;
^
1 error
Prompt>
Can anyone help me out as I have tried several books which conveniently skip the part about compiling errors.
I noticed I don't have a CLASSPATH variable and then i created one with just '.' in it and that didn't work. any help would be appreciated as this is driving me crazy. Thanks.try to change the order of the exception.
first RemoteException and then CreateException -
Jbuilder compiler problem with xml DOM - please help.
my problem is that I am using jbuilder 4 professional to compile/run my code.
However I want to use the XML DOM but jbuilder does not appear to support the necessary packages for use with XML.
How can I get round this.
Can I compile instead from the command line - I am using JDK1.4 which supports the java xml packages necessary. Or is there a way of adding the necessary files to my project?
thanks, BAdd the required jar files to your project properties->classpath in JBuilder
The only problem is that. I have been using JBuilder without any problems. -
C++5.0 compile problem with STL
Hi,
I got the following compiling error, when I am using #include <vector>.
It looks like it complains one variable declared more than once.
The following is the program, nothing but include <vector>.
By the way, I am using C++5.0.
#include <vector>
int main() { }
CC a.cpp
"/usr/include/iso/wchar_iso.h", line 100: Error: Multiple declaration for mbstate_t.
"/opt/SUNWspro/SC5.0/include/CC/./iosfwd", line 51: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
"/opt/SUNWspro/SC5.0/include/CC/./iosfwd", line 78: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
"/opt/SUNWspro/SC5.0/include/CC/rw/iotraits", line 56: Error: The name mbstate_t is ambiguous, std::mbstate_t and std::mbstate_t.
4 Error(s) and 1 Warning(s) detected.
*** Error code 4Hi There,
Is this problem occurs on solaris 8 with WorkShop 5.0?
If it does then do you have patch 107311-11 installed?
I see the same problem reported by other customer where
this patch had fixed the problem. Please let me know.
...jagruti
SUN - DTS -
Hi,
I�am only new to the J2EE platform but have experience with J2SE. I have installed J2EE 1.4 and Tomcat server 5.0.28 to study for the Web Component Developer Exam.
When I go to compile my java files, the compiler doesn�t not recognise the J2EE parts of the file. I have imported the correct classes (even the import statements, it doesn�t recognise!) and when I compile, the errors are associated with J2EE classes (i.e. doesn�t recognise HttpServlet....)
I compile in command prompt by typing: javac myFile.java.
I am aware that the file servlet-api.jar is required for these J2EE extras when compiling and I think this is my problem. I have put the location of this file on my classpath (set classpath=.;C:\fileDir\servlet-api.jar) by it still fails to compile. I have also put this location of the file directly into my PATH by this doesnt help!
Can anybody help me out with this configuration problem?
Thanks very much for any help!You need to have j2ee.jar (which can be found in <j2ee_install_dir>/lib directory in your classpath in order to successfully compile.
-
Runtime.exec Problem with setting environment
Hello
I will run a command with a new process environment. As example I take "ls". If I use the "exec(String)" method it works fine (like it should; my PATH is ...:/usr/bin:...).
Next when I use "exec(String cmd, String[] env)" with cmd = ls and env = {PATH=} then the programm also prints out the listing of the current directory. In my opinion this shoudn't work.
I have the problem using jdk1.2.2 (Solaris VM (build olaris_JDK_1.2.2_10, native threads, sunwjit)) on Solaris 8.
As I understand the exec the method should work like this:
1. fork a new Process
2 set environment for the new process
3 exec the new Programm in this process
Is this statement right?
On Solaris 2.6 the program works fine and I get an IOException.
Some hints way the env for the process isn't set?
Thanks
========================================================
import java.io.*;
public class Test {
/** Version der Klasse. */
public static final String VERSION = "$Revision:$";
public static void main(String[] arg) {
try {
call("ls", new String[]{"PATH="});
} catch (Exception ex) {
System.out.println(ex);
private static void call(String cmd, String[] env)
throws Exception
Runtime rt = Runtime.getRuntime();
try {
System.out.println(cmd);
Process p = rt.exec(cmd, env);
StreamGobbler errorGobbler = new
StreamGobbler(p.getErrorStream(), "ERROR", System.err);
StreamGobbler outputGobbler = new
StreamGobbler(p.getInputStream(), "OUTPUT", System.out);
errorGobbler.start();
outputGobbler.start();
try {
p.waitFor();
} catch (InterruptedException e) {
if (p.exitValue() != 0) {
throw new Exception("Process failed");
} catch (IOException ex) {
System.out.println("IOException: " + ex.toString());
class StreamGobbler extends Thread {
private InputStream m_input;
private OutputStream m_output;
private String m_type;
private StringBuffer m_message;
StreamGobbler(InputStream is, String type, OutputStream os) {
this.m_input = is;
this.m_output = os;
this.m_type = type;
this.m_message = new StringBuffer();
outputGobbler.start();
try {
p.waitFor();
} catch (InterruptedException e) {
if (p.exitValue() != 0) {
throw new Exception("Process failed");
} catch (IOException ex) {
System.out.println("IOException: " + ex.toString());
class StreamGobbler extends Thread {
private InputStream m_input;
private OutputStream m_output;
private String m_type;
private StringBuffer m_message;
StreamGobbler(InputStream is, String type, OutputStream os) {
this.m_input = is;
this.m_output = os;
this.m_type = type;
this.m_message = new StringBuffer();
public synchronized void run() {
try {
InputStreamReader reader = new InputStreamReader(m_input);
BufferedReader bufferedReader = new BufferedReader(reader);
PrintWriter writer = new PrintWriter(m_output, true);
String line = null;
while ( (line = bufferedReader.readLine()) != null) {
writer.println(m_type + "> " + line);
this.m_message.append(m_type + "> " + line + "\r\n");
} catch (IOException ioe) {
ioe.printStackTrace();
public synchronized String getMessage() {
return this.m_message.toString();I'm having the same problem...
Have you been able to solve your problem yet?
Maybe you are looking for
-
Why Doesn't my twitter come up in notifications?
It says that twitter is set up in notification (yes i am using mountain lion) but the tweets never come up in the top right corner?? any suggestions would be good
-
I installed the update for iphoto propperly, but in the app store icon in dock the red 1 still shows up and I cant get rid of it.file://localhost/Volumes/Daten/Users/AG/Desktop/Bildschirmfoto%202012-10-08% 20um%2011.11.13.pngfile://localhost/Volumes/
-
I bought an iphone just 3 weeks back.... but its not switching on... i tried pressing te power key +home key.. still it dint work out... pls any 1 help me... can i get a replacement
-
Is it possible to delete individual instant messag...
I understand how to go into tools and delete my entire instant messaging history, but can I delete individual text messages and, if so, how?
-
Phonon/qt and qt/qtmod upgrade issue
Hi, I am running Arch i686 with [KDEMOD]. When i do my daily pacman -Syu i get the following: stefan ~ $ sudo pacman -Syu :: Synchronizing package databases... kdemod-core is up to date kdemod-extragear is up to date core is up to date extra is up to