Segmentation fault but now errors when running Valgrind

Discussion in 'C++' started by carl, Nov 28, 2009.

  1. carl

    carl Guest

    I have made an application that throws a segmentation fault when I run it.

    ../MyApp
    Segmentation fault

    I have then tried to run it with Valgrind:


    valgrind --leak-check=yes --track-origins=yes ./MyApp
    ==8389==
    ==8389== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 1)
    ==8389== malloc/free: in use at exit: 0 bytes in 0 blocks.
    ==8389== malloc/free: 13,153,309 allocs, 13,153,309 frees,
    8,529,290,300 bytes allocated.
    ==8389== For counts of detected errors, rerun with: -v
    ==8389== All heap blocks were freed -- no leaks are possible.


    So Valgrind cannot find any errors but I still get a segmentation fault when
    running the app without Valgrind.

    I have used almost a week to go through the code and I have written
    unit-test for each part. Any ideas on how to find this error when valgrind
    fails to find it or is the just a program that is cursed?
     
    carl, Nov 28, 2009
    #1
    1. Advertising

  2. carl

    Ian Collins Guest

    carl wrote:
    > I have made an application that throws a segmentation fault when I run it.
    >
    > ./MyApp
    > Segmentation fault


    What happens when you run the application under a debugger?

    --
    Ian Collins
     
    Ian Collins, Nov 28, 2009
    #2
    1. Advertising

  3. carl

    carl Guest

    "Ian Collins" <> wrote in message
    news:...
    > carl wrote:
    >> I have made an application that throws a segmentation fault when I run
    >> it.
    >>
    >> ./MyApp
    >> Segmentation fault

    >
    > What happens when you run the application under a debugger?
    >
    > --
    > Ian Collins


    I have tried that but the error first appears when a subrutine is called
    after 20.000 to 30.000 iterations. I have made something like this:

    if (call_count < call_limit) {

    //call the failing function
    call_count++;
    }

    When I set call_limit is between 20.000 and 30.000 it works fine but it
    varies from call to call.

    One possible way would be to put a break inside the above if-statement and
    then have a starting count and a end count. But the interval would still be
    around a few thousands and my fingers will begin to bleed if I need to press
    the skip key in the debugger that many times.
     
    carl, Nov 28, 2009
    #3
  4. carl

    Ian Collins Guest

    carl wrote:
    >
    > "Ian Collins" <> wrote in message
    > news:...
    >> carl wrote:
    >>> I have made an application that throws a segmentation fault when I
    >>> run it.
    >>>
    >>> ./MyApp
    >>> Segmentation fault

    >>
    >> What happens when you run the application under a debugger?
    >>

    >
    > I have tried that but the error first appears when a subrutine is called
    > after 20.000 to 30.000 iterations. I have made something like this:


    So? Let it run and let the debugger catch the seg fault.

    --
    Ian Collins
     
    Ian Collins, Nov 29, 2009
    #4
  5. carl

    Ashu Guest

    On Nov 28, 4:23 pm, "carl" <carl@.com> wrote:
    > "Ian Collins" <> wrote in message
    >
    > news:...
    >
    > > carl wrote:
    > >> I have made an application that throws a segmentation fault when I run
    > >> it.

    >
    > >> ./MyApp
    > >> Segmentation fault

    >
    > > What happens when you run the application under a debugger?

    >
    > > --
    > > Ian Collins

    >
    > I have tried that but the error first appears when a subrutine is called
    > after 20.000 to 30.000 iterations. I have made something like this:
    >
    > if (call_count < call_limit) {
    >
    >   //call the failing function
    >   call_count++;
    >
    > }
    >
    > When I set call_limit is between 20.000 and 30.000 it works fine but it
    > varies from call to call.
    >
    > One possible way would be to put a break inside the above if-statement and
    > then have a starting count and a end count. But the interval would still be
    > around a few thousands and my fingers will begin to bleed if I need to press
    > the skip key in the debugger that many times.


    hey, you might be using some other version of compiler dependent
    library.
    I faced some problem using libgcc3.2 earlier with my application and
    it used to crash. I changed library and it works smooth.
     
    Ashu, Nov 29, 2009
    #5
  6. Ian Collins wrote:
    > carl wrote:
    >>
    >> "Ian Collins" <> wrote in message
    >> news:...
    >>> carl wrote:
    >>>> I have made an application that throws a segmentation fault when I
    >>>> run it.
    >>>>
    >>>> ./MyApp
    >>>> Segmentation fault
    >>>
    >>> What happens when you run the application under a debugger?
    >>>

    >>
    >> I have tried that but the error first appears when a subrutine is
    >> called after 20.000 to 30.000 iterations. I have made something like
    >> this:

    >
    > So? Let it run and let the debugger catch the seg fault.
    >


    To add a small details : when it happens, use the backtrace option and
    see what caused it.

    --
    ultrasound www.ezono.com
     
    Vladimir Jovic, Dec 1, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    9
    Views:
    501
    Dan Pop
    Nov 10, 2003
  2. Maxx
    Replies:
    17
    Views:
    1,120
    James Kuyper
    Jan 2, 2012
  3. Vladimir Konrad
    Replies:
    3
    Views:
    135
    Vladimir Konrad
    Feb 26, 2007
  4. Arrix
    Replies:
    1
    Views:
    195
    Roger Pack
    Aug 16, 2008
  5. Deepak Kannan
    Replies:
    1
    Views:
    144
    Roger Pack
    Aug 2, 2010
Loading...

Share This Page