Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Aug 2002 04:57:02 -0700 (PDT)
From:      Ross Lippert <ripper@eskimo.com>
To:        freebsd-questions@freebsd.org, freebsd-ports@freebsd.org
Cc:        zorn@boulder.colorado.edu
Subject:   memory profiling
Message-ID:  <200208261157.EAA26501@eskimo.com>

next in thread | raw e-mail | index | archive | help

Hi, I'm not sure if this is a port or a base problem, but I am trying
to find a memory leak in a 3rd party program and I am trying to use
the mprof port to do it (if there is a better port to use for this, I
welcome recommendations).

(using FreeBSD-4.6-RELEASE)

/usr/ports/devel/mprof seems to create a libc_mp.a which is to be linked
which has different malloc,et al, functions in it, so I did, what I thought
was the right thing:
$ gcc -g test.c /usr/local/lib/libc_mp.a
or
$ gcc -g test.c -L /usr/local/lib -lc_mp
and I get
/tmp/ccEeiQfR.o: In function `main':
/home/ripper/Choices/MyApps/Other/test.c(.text+0x13): undefined reference to `_malloc_leap'
/home/ripper/Choices/MyApps/Other/test.c(.text+0x7f): undefined reference to `_free_leap'

I'm not sure where _malloc/free_leap are supposed to be defined, whether
this is a problem of the port or a problem of the base -- like maybe
these functions are expected to be in regular libc but aren't.  I have
grepped around my */lib/* directories and not seen anything which
defines these symbols.

-r
PS my test program is
#include <stdio.h>
#include <stdlib.h>
#include <dmalloc.h>

int main() {
  int i;
  char *p = (char *) malloc(20*sizeof(char));

  fprintf(stderr,"%x\n",p);
  for(i=0; i < 20; ++i) fprintf(stderr,"%c",p[i]);

  free(p);
}


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208261157.EAA26501>