Thread: GDB showing memory error

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    50

    GDB showing memory error

    Hi

    I am facing a peculiar problem. When i am running my binary it is running fine. But when i am running with gdb it is showing some memory error. Can anyone tell what could be the reason for this?

    Thanks in advance
    Sas

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    Unless you post what's the error, what's the relevant code...
    Did you compile with -g option ? before running with gdb?
    You could also use valgrind to check memory problems with your program.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    50
    I am having jni call from my code

    It is showing error like this

    Program received signal SIGSEGV, Segmentation fault.
    0x00002aaaac3dd66e in checked_jni_DeleteLocalRef () from /opt/jvm64/jdk1.6.0_17/jre/lib/amd64/server/libjvm.so

    Thanks
    Sas

  4. #4
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Without seeing your code, I can't say for sure. My guess is you're probably passing an uninitialized pointer into checked_jni_DeleteLocalRef (perhaps by way of some other function that ultimately calls checked_jni_DeleteLocalRef). You're simply getting lucky that the uninitialized value is in a valid piece of memory when running normally, but it happens to be invalid when using the debugger.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM