Iñigo wrote:
C:\Archivos de programa\FreeMind\lib>java -Xmx1g -verbose:gc* -jar
freemind.jar
GC v4 M1-39 (2006-03-28)
GC will incrementally slide compact at each GC, using algorithm = 2
Chunks will be swept on allocation
WARNING: final heap size is too large, reduced to 900 Mb
java heap initial size 64 Mb, maximum size 900 Mb (38400000h),
addresses
range 2
0020000 - 58420000
java.lang.OutOfMemoryError
<no stack trace available>
Iñigo, the log above doesn't have any collection messages, thus
no collection had taken place, and the OutOfMemoryError is most
likely
caused by some other reason -- not the java heap shortage.
I have just grepped DRLVM and found about 25 places where OOM is
thrown
explicitly in the VM.
Applying following patch and running with '-verbose:oom -
verbose:gc*'
may shed some light on the reason of the problem.
-- >8 --
diff --git vm/vmcore/src/class_support/Class_File_Loader.cpp
vm/vmcore/src/class_support/Class_File_Loader.cpp
index 0ec087f..259cc87 100644
--- vm/vmcore/src/class_support/Class_File_Loader.cpp
+++ vm/vmcore/src/class_support/Class_File_Loader.cpp
@@ -518,6 +518,7 @@ bool Field::parse(Class *clss, Const_Poo
//std::stringstream ss;
//ss << clss->name->bytes << ": could not create type
descriptor for field " << get_name();
//jthrowable exn = exn_create("java/lang/OutOfMemoryError",
ss.str().c_str());
+ INFO2("oom", "out of memory when creating type desc");
exn_raise_only(VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return false;
}
diff --git vm/vmcore/src/class_support/classloader.cpp
vm/vmcore/src/class_support/classloader.cpp
index ea4e231..12e9ea1 100644
--- vm/vmcore/src/class_support/classloader.cpp
+++ vm/vmcore/src/class_support/classloader.cpp
@@ -1139,8 +1139,7 @@ Class* ClassLoader::AllocateAndReportIns
if(new_java_lang_Class == NULL)
{
tmn_suspend_enable();
- // couldn't allocate java.lang.Class instance for
this class
- // ppervov: TODO: throw OutOfMemoryError
+ INFO2("oom", "couldn't allocate java.lang.Class
instance
for this class");
exn_raise_only(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return NULL;
diff --git vm/vmcore/src/exception/exceptions.cpp
vm/vmcore/src/exception/exceptions.cpp
index f37a0af..996d9c4 100644
--- vm/vmcore/src/exception/exceptions.cpp
+++ vm/vmcore/src/exception/exceptions.cpp
@@ -153,6 +153,8 @@ static jthrowable create_exception(const
if (!e) {
tmn_suspend_enable();
+ INFO2("oom", "out of memory on creating exception object "
+ << exception_name);
return VM_Global_State::loader_env-
>java_lang_OutOfMemoryError;
}
@@ -180,6 +182,8 @@ static jthrowable create_exception(const
if (!e) {
tmn_suspend_enable();
+ INFO2("oom", "out of memory on creating exception object "
+ << exception_name);
return VM_Global_State::loader_env-
>java_lang_OutOfMemoryError;
}
@@ -216,6 +220,8 @@ static jthrowable create_exception(const
if (!exc_obj) {
tmn_suspend_enable();
+ INFO2("oom", "out of memory on creating exception object "
+ << exception_name);
return VM_Global_State::loader_env-
>java_lang_OutOfMemoryError;
}
@@ -230,6 +236,8 @@ static jthrowable create_exception(const
if (!arg_obj) {
tmn_suspend_enable();
+ INFO2("oom", "out of memory on creating exception
object "
+ << exception_name);
return
VM_Global_State::loader_env->java_lang_OutOfMemoryError;
}
diff --git vm/vmcore/src/jit/jit_runtime_support.cpp
vm/vmcore/src/jit/jit_runtime_support.cpp
index de30891..88d547c 100644
--- vm/vmcore/src/jit/jit_runtime_support.cpp
+++ vm/vmcore/src/jit/jit_runtime_support.cpp
@@ -1834,6 +1834,7 @@ void *vm_malloc_with_thread_pointer(
assert(!tmn_is_suspend_enabled());
void *result = gc_alloc(size,ah,tp);
if (!result) {
+ INFO2("oom", "out of gc heap memory");
exn_throw(VM_Global_State::loader_env->java_lang_OutOfMemoryError);
return 0; // whether this return is reached or not is solved
via is_unwindable state
}
@@ -1863,6 +1864,7 @@ #endif //VM_STATS
gc_alloc(c->instance_data_size,
c->allocation_handle, vm_get_gc_thread_local());
if (!o) {
+ INFO2("oom", "out of gc heap memory");
exn_throw(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
//tmn_suspend_enable();
@@ -1887,6 +1889,7 @@ #endif //VM_STATS
gc_alloc(vtable->allocated_size,
vtable->clss->allocation_handle,
vm_get_gc_thread_local());
if (!o) {
+ INFO2("oom", "out of gc heap memory");
exn_throw(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return NULL; // reached by interpreter and from JNI
@@ -1916,6 +1919,7 @@ class_alloc_new_object_and_run_construct
obj->object = (ManagedObject*)
gc_alloc(clss->instance_data_size, clss->allocation_handle,
vm_get_gc_thread_local());
if (!obj->object) {
+ INFO2("oom", "out of gc heap memory");
exn_throw_only(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return 0; // should never be reached
diff --git vm/vmcore/src/jni/jni.cpp vm/vmcore/src/jni/jni.cpp
index b730214..7a3d6fa 100644
--- vm/vmcore/src/jni/jni.cpp
+++ vm/vmcore/src/jni/jni.cpp
@@ -657,6 +657,7 @@ jobject JNICALL NewLocalRef(JNIEnv *env,
if (NULL == h)
{
tmn_suspend_enable();
+ INFO2("oom", "out of native heap memory on creating local
reference");
exn_raise_only(
(jthrowable)(((JNIEnv_Internal*)env)->vm->vm_env-
>java_lang_OutOfMemoryError));
return NULL;
diff --git vm/vmcore/src/jni/jni_utils.cpp
vm/vmcore/src/jni/jni_utils.cpp
index 185bb6c..1c1380c 100644
--- vm/vmcore/src/jni/jni_utils.cpp
+++ vm/vmcore/src/jni/jni_utils.cpp
@@ -251,6 +251,7 @@ char* ParameterTypesToMethodSignature (J
if (NULL == sig) {
//throw_exception_from_jni (env, "java/lang/
OutOfMemoryError",
name);
+ INFO2("oom", "out of memory on creating class signature");
exn_raise_only(VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return (char *)0;
}
diff --git vm/vmcore/src/object/vm_arrays.cpp
vm/vmcore/src/object/vm_arrays.cpp
index 5f407fc..73acaf6 100644
--- vm/vmcore/src/object/vm_arrays.cpp
+++ vm/vmcore/src/object/vm_arrays.cpp
@@ -106,6 +106,7 @@ #ifdef VM_STATS
#endif //VM_STATS
if (NULL == object_array) {
+ INFO2("oom", "out of java heap memory on allocating
array");
exn_throw(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return NULL; // may be reached on interpreter or when called
from jni
@@ -152,6 +153,7 @@ #ifdef VM_STATS
#endif //VM_STATS
if (NULL == vector) {
+ INFO2("oom", "out of java heap memory on allocating
primitive
array");
exn_throw(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return 0; // may be reached when interpreter is used
@@ -227,6 +229,7 @@ #endif //VM_STATS
assert( ! tmn_is_suspend_enabled());
if (NULL == vector) {
+ INFO2("oom", "out of java heap memory on allocating
array");
exn_throw(
VM_Global_State::loader_env-
>java_lang_OutOfMemoryError);
return 0; // should never be reached
diff --git vm/vmcore/src/thread/object_generic.cpp
vm/vmcore/src/thread/object_generic.cpp
index 11296e5..234c340 100644
--- vm/vmcore/src/thread/object_generic.cpp
+++ vm/vmcore/src/thread/object_generic.cpp
@@ -387,6 +387,7 @@ jobject object_clone(JNIEnv *jenv, jobje
}
if (result == NULL) {
tmn_suspend_enable();
+ INFO2("oom", "out of java heap memory on cloning object");
exn_throw(VM_Global_State::loader_env->java_lang_OutOfMemoryError);
return NULL;
}
diff --git vm/vmcore/src/util/vm_strings.cpp
vm/vmcore/src/util/vm_strings.cpp
index f1fe7cb..7bf04b2 100644
--- vm/vmcore/src/util/vm_strings.cpp
+++ vm/vmcore/src/util/vm_strings.cpp
@@ -245,6 +245,7 @@ static void string_create(unsigned unico
Vector_Handle array = gc_alloc(sz, clss->allocation_handle,
vm_get_gc_thread_local());
if (!array) { // OutOfMemory should be thrown
*str = NULL;
+ INFO2("oom", "out of java heap memory on string creation");
exn_throw(VM_Global_State::loader_env->java_lang_OutOfMemoryError);
return;
}
--------------------------------------------------------------------
-
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: harmony-dev-
[EMAIL PROTECTED]