memprof

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sean

    #1

    memprof

    I am trying to use memprof-0.5.1(because apt-get memprof gives me this
    version, although I know version 0.6 came out recently) to debug my
    program. My Linux box is a ubuntu, here I list its
    kernel/glibc/linker/compiler info
    --------------------------------------------------
    uname -a
    =Linux 2.6.16.27-gg1-em64t #1 SMP
    getconf GNU_GLIBC_VERSI ON
    =>glibc 2.3.5
    ld --version
    =>GNU ld version 2.16.1 Debian GNU/Linux
    Copyright 2005 Free Software Foundation, Inc
    gcc --version
    =>gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
    memprof --version
    =>memprof 0.5.1
    --------------------------------------------------

    When I test this following simple case by
    #gcc -o mytest -g main.c
    #memprof mytest
    The system hang there when I select File->Run Program->(select mytest),
    and also an error message popped up in the console:
    *** glibc detected *** free(): invalid pointer: 0x4e401580 ***


    -----------------main.c------------------------
    #include <stdlib.h>
    #include <stdio.h>
    void foo(){
    int i = 0, j = 8, k = 0;
    for(i = 0 ; i < 20; i ++){
    malloc(100);
    k = j;
    while(j < 2*k){
    j++;
    }
    j = 2*k;
    printf("k = %d\n", k);
    }
    }
    int main(){
    int i = 0, j =2;
    for(i = 0; i < 10; i++){
    j = j * 2;
    foo();
    }
    }
    ----------end of main.c -----------------

  • Victor Bazarov

    #2
    Re: memprof

    Sean wrote:
    I am trying to use memprof-0.5.1(because apt-get memprof gives me this
    version, although I know version 0.6 came out recently) to debug my
    program. My Linux box is a ubuntu, here I list its
    kernel/glibc/linker/compiler info
    --------------------------------------------------
    [..]
    -----------------main.c------------------------
    [..]
    ----------end of main.c -----------------
    You have asked about using a system-specific tool to find errors in a C
    program. What makes you thing either of those is topical in a C++ language
    newsgroup?

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    Working...