Monday, April 12, 2010

Java Notes API prints "PANIC: Insufficient memory."

Problem:
A Java application using the Java Notes API (for IBM Domino server) printed:

Thread=[1934:0002-193C]
Stack base=0x0032EB34, Stack size = 1248 bytes PANIC: Insufficient memory.

when it was reading and writing to a large size NSF file ~2GB .

Solution:
setting the JVM maximum heap to 200MB with "-Xmx200m"

Why this resolve the issue?
When launching a JVM without "-Xmx" parameter the JVM set it to a default value which on Windows platform is half of the real memory.
As the machine had 3.5 GB RAM , it means the JVM tried to reserve 1.7 GB for the process.
The Java Notes API uses the process shared memory to handle the nsf.
it PANIC when it could not allocate more memory, as 1.7 GB of process memory space was already reserved by the JVM.

What facts suggested the cause?
The domino server NSD contained the following:
COMMIT RESERVED TOTAL
PRIVATE: 25.1M 1.7G 1.7G
MAPPED: 174.9M 4.5M 179.4M
IMAGE: 56.1M 0.0K 56.1M
TOTAL: 256.1M 1.7G 2.0G
which indicated that the memory was reserved by the Java application and not by the Java Notes API

Wednesday, January 27, 2010

ant compile without debug information by default

I've wrote a build.xml for a java project and found out that the application trace contained exceptions stack trace with "(Unknown Source)" instead of line numbers.
I found out that ant compile without debug information by default.

The way to set debug information is by adding
debug="true" debuglevel="lines,vars,source"
to the javac task.


Sunday, January 10, 2010

Can not open solutions and projects in Visual Studio 2003

One day I could not open solutions and projects in my Visual Studio 2003 - every time I've doubled click the solution then the Visual Studio had crashed immediately.


The Solution:
delete my account profile for VisualStuido in windows by:
1) go Documents and Settings - Find your account - Application Data - Microsoft - delete your VisualStudio folder.
2) go Documents and Settings - Find your account - Local Settings - Application Data - Microsoft -delete your VisualStudio folder.

The Investigation:
I've Googled with th error in the Windows event viewer log.

Wednesday, December 30, 2009

JNI_CreateJavaVM failed with "Failed to find VM - aborting" in Linux for IBM JDK1.5

I was trying to use IBM JDK 1.5 JNI in Linux.
I've added the libjvm.so path i.e. "ibm-jre/jre/bin/classic" to the LD_LIBRARY_PATH.
when I launched the code I've got "Failed to find VM - aborting" message after running the JNI_CreateJavaVM.
after investigating this for a while I found that the JVM lib is loading other libs that are located in "ibm-jre/jre/bin" path.
So adding both "ibm-jre/jre/bin/classic" and "ibm-jre/jre/bin" to the LD_LIBRARY_PATH resolved the issue and the JVM was initate Okay.

BTW, When I tried to use IBM JDK1.6 in Linux with only "ibm-jre/jre/bin/classic" in the LD_LIBRARY_PATH then the JVM was launched Okay.