Menu

#5 Crashing on Memory allocation

Stable release
open
5
2007-04-05
2007-04-04
Anonymous
No

When I tried running a java code the application is crashing. Tried debugging it found that it is memory allocation error the error got from GBD is as follows :

Program received signal SIGINT, Interrupt.
0x00fa6e36 in _Jv_AllocBytes (size=10)
at /home/gautam/Desktop/jrate-0.3.7.2-3.3.6/build/gcc/libjava/jRate-gc.cc:110
110 void* obj = ma->allocateBytes(size);

As Tried looking into the program it was returning a null pointer. Can you just tell me how to debug or is there any patch available for this fix.

Thank You

Discussion

  • Morgan Deters

    Morgan Deters - 2007-04-05
    • labels: 702170 --> Crashes at runtime
    • assigned_to: nobody --> mdeters
     
  • Morgan Deters

    Morgan Deters - 2007-04-05

    Logged In: YES
    user_id=1176477
    Originator: NO

    If you're on a Linux 2.6 kernel, you might try setting the environment variable LD_ASSUME_KERNEL=2.4.1 when you run your jRate-compiled program. It could be an issue with NPTL, which jRate doesn't always play nicely with.

    Does the error still occur if you set LD_ASSUME_KERNEL? If not, you have a workaround until we fix jRate's threading model. If so, I'll need to know more about the code you're using---is it one of the demos, or your own? Does it manipulate RTSJ memory areas (say, entering ScopedMemory areas)?

     
  • Gautam

    Gautam - 2007-04-05

    Logged In: YES
    user_id=1761498
    Originator: NO

    Iam Using My own code written in java which uses the java native interfaces which looks as follows

    class Timer_Use1{
    public long secs;
    public long nanosecs;

    private native void Get_Time();

    Timer_Use1(){
    secs=(long)10;
    nanosecs=(long)10;
    }

    public static void main(String[] args){

    Timer_Use1 t = new Timer_Use1();
    Timer_Use1 Start=new Timer_Use1();
    Timer_Use1 Stop=new Timer_Use1();

    Start.Get_Time();

    System.out.println("The Value Of Start Function in secs "+ Start.secs);
    System.out.println("The Value of the start fucntion :"+Start.nanosecs);
    }

    static {
    System.loadLibrary("Get_Real_Clock");
    }

    }

     
  • Gautam

    Gautam - 2007-04-09

    Logged In: YES
    user_id=1761498
    Originator: NO

    I tried running using LD_ASSUME_KERNEL but i dosn't work becuase gclib dosen't work for kernels 2.6.8 and higher . Can you suggest a way for running the code.

     
  • Morgan Deters

    Morgan Deters - 2007-04-09

    Logged In: YES
    user_id=1176477
    Originator: NO

    I got your code working without difficulty. (I used a no-op native implementation of your Get_Time() implementation, I assume it just does an rdtsc or equivalent.) LD_ASSUME_KERNEL shouldn't be an issue in this case, since you aren't even doing anything with threads. Is there anything nontrivial in your native code?

    Below there's a log of exactly what I did, for comparison. I assume you're running jRate 0.3.7.2 on desktop Linux? Which distribution? How was it compiled? Which version of GCC did you build atop---3.3.3 or 3.3.6 or something else? (Below I'm using 3.3.3.)

    [mgd@limbo jRate]$ export CLASSPATH=.
    [mgd@limbo jRate]$ export LD_LIBRARY_PATH=/home/limbo/mdeters/jRate/jrate-0.3.7.2-3.3.3-prefix/lib
    [mgd@limbo jRate]$ jRate-gcj -C Timer_Use1.java
    [mgd@limbo jRate]$ jRate-gcjh -jni Timer_Use1
    [mgd@limbo jRate]$ jRate-gcc -shared -I. Timer_Use1.c -o libGet_Real_Clock.so
    [mgd@limbo jRate]$ jRate-gcj -fjni Timer_Use1.java --main=Timer_Use1 -o Timer_Use1
    [mgd@limbo jRate]$ su
    Password:
    limbo:/home/limbo/mdeters/jRate# export LD_LIBRARY_PATH=.:/home/limbo/mdeters/jRate/jrate-0.3.7.2-3.3.3-prefix/lib
    limbo:/home/limbo/mdeters/jRate# ./Timer_Use1
    The Value Of Start Function in secs 10
    The Value of the start fucntion :10
    limbo:/home/limbo/mdeters/jRate#

     
  • Jerry James

    Jerry James - 2007-04-18

    Logged In: YES
    user_id=6425
    Originator: NO

    I'm the advisor of the original reporter. We looked a bit further into this. It is starting to appear that GCC 4.1.1, which we have on our Fedora Core 6 boxes, miscompiles at least part of the code. We're getting a NULL pointer back from a function that is supposed to return a reference to a global object. I'll look into it some more and see if I can find a solution.

    Is anybody working on a port to GCC 4.x?

     
  • Morgan Deters

    Morgan Deters - 2007-04-18

    Logged In: YES
    user_id=1176477
    Originator: NO

    Thanks for the update.. I'm surprised you built the jRate release version with GCC 4.1.1 though-- GCC 3.3.3 doesn't compile cleanly with GCC 4.x without a small patch (which jRate-svn includes but 0.3.7.2 does not). This is in stage 1 code, so GCC 3.3.3 can't even bootstrap from GCC 4.x.

    libjRateCore, libgcj, etc., should all be built using the compiler just built (which is a modified GCC 3.3.3). Is the errant code in libgcj? (It appears to be so in the original bug report, related to memory areas.)

    Yes, we are interested in a GCC 4.x "port" of jRate, to get all the bugfixes and enhancements (especially to Java stuff!) since GCC's 3.3 release series. We've done part of the work, but it's not stable yet.

     

Log in to post a comment.