Purify with GCC

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pavanghooli
    New Member
    • Feb 2008
    • 4

    Purify with GCC

    Hi,
    Can any one explain me how to correct the purify reported errors and warning( mem leaks), with simple examples.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by pavanghooli
    Hi,
    Can any one explain me how to correct the purify reported errors and warning( mem leaks), with simple examples.
    Purify would clearly say you the function call sequence which resulted with every leak.
    You have to start looking at the sequence and start clearing the error.
    If you need something else post again

    Raghuram

    Comment

    • pavanghooli
      New Member
      • Feb 2008
      • 4

      #3
      Thanks for your response
      I tried with simple program simple.cpp
      #include<iostre am.h>
      int main() {
      char *str = new char[25];
      " Testing purify ";
      cout << " str is " << str << endl ;
      delete[] str ;

      return 0;
      }

      commands:
      compiling -> purify g++ -g -gstabs simple.cpp
      executing-> ./a.out

      But purify giving memory leaks, even i added delete statement.
      Please correct the above program to make memory leaks zero.

      Thanks
      Pavan Ghooli.




      Originally posted by gpraghuram
      Purify would clearly say you the function call sequence which resulted with every leak.
      You have to start looking at the sequence and start clearing the error.
      If you need something else post again

      Raghuram

      Comment

      • gpraghuram
        Recognized Expert Top Contributor
        • Mar 2007
        • 1275

        #4
        I have ran purify separately and calling the executable from purify.
        I think what u are trying is to compile the code with purify instrumentation .

        Try running the executable from purify and check whether u are getting any leaks

        Raghuram

        Comment

        • pavanghooli
          New Member
          • Feb 2008
          • 4

          #5
          I am sorry, can we call executable from purify?
          U mean compile without purify
          g++ -g -gstabs simple.cpp
          then invoke the executable from purify.
          purify <may_some_optio ns> a.out

          I searched in net for long time, no where found that we can invoke exe from purify.
          Please explain me with simple program(wat i written), with commands also.

          Thanks
          Pavan Ghooli.

          Originally posted by gpraghuram
          I have ran purify separately and calling the executable from purify.
          I think what u are trying is to compile the code with purify instrumentation .

          Try running the executable from purify and check whether u are getting any leaks

          Raghuram

          Comment

          • gpraghuram
            Recognized Expert Top Contributor
            • Mar 2007
            • 1275

            #6
            Originally posted by pavanghooli
            I am sorry, can we call executable from purify?
            U mean compile without purify
            g++ -g -gstabs simple.cpp
            then invoke the executable from purify.
            purify <may_some_optio ns> a.out

            I searched in net for long time, no where found that we can invoke exe from purify.
            Please explain me with simple program(wat i written), with commands also.

            Thanks
            Pavan Ghooli.

            I have used Purify on windows some time back.
            As u start purify u will get a GUI in which you can call the executable.
            Try to read the Purify user guide for this.

            Raghuram

            Comment

            • pavanghooli
              New Member
              • Feb 2008
              • 4

              #7
              Thanks a lot.

              Pavan Ghooli

              Originally posted by gpraghuram
              I have used Purify on windows some time back.
              As u start purify u will get a GUI in which you can call the executable.
              Try to read the Purify user guide for this.

              Raghuram

              Comment

              Working...