Analysis of Mauve failures - The final chapter

Mark Wielaard mark@klomp.org
Mon Apr 8 14:56:00 GMT 2002


Hi,
On Mon, 2002年04月08日 at 22:35, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
>> Mark> import java.lang.reflect.Array;
> Mark> public class Big
> Mark> {
> Mark> public static void main(String[] args)
> Mark> {
> Mark> String[][] t = (String[][]) Array.newInstance(String.class,
> Mark> new int[] {Integer.MAX_VALUE, Integer.MAX_VALUE});
> Mark> System.out.println(t.length);
> Mark> }
> Mark> }
>> I tried this. I get this result:
>> creche. gcj --main=Big -o Big Big.java -Wl,-rpath,/x1/gcc3/install/lib
> creche. ./Big
> Out of Memory! Returning NIL!
>> This isn't what I expected. I expected OutOfMemoryError to be thrown
> and a stack trace to be printed.
>> I definitely didn't see the failure that you report.

Notice that you also didn't get any output from the println().
Try running the program under gdb. I just tried and when I just run it
it exists without printing anything. Running it under gdb always gives
the SIGSEGV (make sure you recompile libgcj without -O2 otherwise gdb
will give some misleading backtraces).
 
> Mark> It seems to me that something like the following is needed since
> Mark> the Class type does not have to be an array class with
> Mark> Array.newInstanceOf()
>> In Array.newInstance(Class,int[]) we compute the array type, which we
> then pass to _Jv_NewMultiArray:
>> jclass arrayType = componentType;
> for (int i = 0; i < ndims; i++) // FIXME 2nd arg should 
> // be "current" loader
> arrayType = _Jv_GetArrayClass (arrayType, 0);
>> So I don't think this patch is necessary. I think something else is
> going on here. What do you think?

You are right. I missed that for loop, must have been the
indenting/whitespace.
Hmmm. I am really lost here. I do not even have a clue why the program
segfaults when run under gdb but seems to terminate normally (although
without giving output) without gdb. And on another machine with less
memory it is just killed after a while by the kernel because it gets out
of memory.
Regards,
Mark


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /