Re: Garbage collector: Out of memory (w hen running AWT/SWING code on arm-li nux)

"ffileppo" <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
> ffileppo wrote:
> >> Hi guys,
> >>
> >> I'm getting the following error:
> >>
> >> GC Warning: Out of Memory! Returning NIL!
> >>
> >> when I try to run any AWT/SWING code compiled with arm-linux-gcj on my embedded box (PXA270 - 128MB Ram). (Other code just runs fine)
> >>
> >> For example this code:
> >>
> >> import javax.swing.*;
> >>
> >> public class SimpleFrame {
> >>   public static void main(String args[]) {
> >>     System.out.println("Check 1");
> >>     JFrame f = new JFrame("Simple Frame");
> >>     System.out.println("Check 2");
> >>     f.setSize(200,100);
> >>     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> >>     f.setVisible(true);
> >>   }
> >> }
> >>
> >> gives out of memory error after printing "Check 1".
> >> Trying with some other code I can see that the first AWT/SWING call causes this error.
> >>
> >> Any idea to fix / debug this problem?
>
> I think I've found it.  The unwinder is infinitely looping 'til it runs out
> of memory.
>
> Some library somewhere has probably has invalid unwind information.
>
> Add this line to _Jv_StackTrace::UnwindTraceFn in stacktrace.cc:
>
> *** stacktrace.cc~      Tue Sep  4 19:00:31 2007
> --- stacktrace.cc       Fri Jun  6 17:42:25 2008
> ***************
> *** 110,115 ****
> --- 110,117 ----
>     // Check if the trace buffer needs to be extended.
>     if (pos == state->length)
>       {
> +       return _URC_END_OF_STACK;
> +
>         int newLength = state->length * 2;
>         void *newFrames = _Jv_AllocBytes (newLength * sizeof(_Jv_StackFrame));
>         memcpy (newFrames, state->frames, state->length * sizeof(_Jv_StackFrame));
>
> This will prevent more than 100 stack frames from being traced.
>
> Andrew.
>


Thank you Andrew,
I'll try this in the next days and I'll let you know.

Francesco
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.