From owner-freebsd-questions Wed Feb 12 8:25:16 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4437837B401 for ; Wed, 12 Feb 2003 08:25:14 -0800 (PST) Received: from mail020.syd.optusnet.com.au (mail020.syd.optusnet.com.au [210.49.20.135]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CAF143F3F for ; Wed, 12 Feb 2003 08:25:12 -0800 (PST) (envelope-from izzo@optusnet.com.au) Received: from kalgan.local (c18428.eburwd1.vic.optusnet.com.au [210.49.180.23]) by mail020.syd.optusnet.com.au (8.11.1/8.11.1) with ESMTP id h1CGPBH16984 for ; Thu, 13 Feb 2003 03:25:11 +1100 Received: from kalgan.local (izzo@localhost [127.0.0.1]) by kalgan.local (8.12.6/8.12.6) with ESMTP id h1CGPCaN068732 for ; Thu, 13 Feb 2003 03:25:12 +1100 (EST) (envelope-from izzo@kalgan.local) Received: (from izzo@localhost) by kalgan.local (8.12.6/8.12.6/Submit) id h1CGPCjl068731 for freebsd-questions@freebsd.org; Thu, 13 Feb 2003 03:25:12 +1100 (EST) Date: Thu, 13 Feb 2003 03:25:12 +1100 From: Sam Izzo To: freebsd-questions@freebsd.org Subject: memory leak problem Message-ID: <20030212162511.GA68413@kalgan.vic.optushome.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, Woops, sorry about my other "asdf" spam email.. :-) This might be a stupid/obvious question but dmalloc is reporting that I have a memory leak in the following (test) program and I don't know why: #include #include #include int main(int argc, char **argv) { char *c = malloc(10); strcpy(c, "hello"); printf("c=%s\n", c); free(c); return 1; } dmalloc is installed in my account and I compiled it with: gcc -g test.c -o test /home/izzo/usr/lib/libdmalloc.a -I/home/izzo/usr/include I set dmalloc up with: dmalloc -i 200 -l dmlog high and at the end of my log file (snipped for brevity) is: 1045066226: 3: total-size count in-use-size count source 1045066226: 3: 4096 1 4096 1 ra=0x280e57ec 1045066226: 3: 10 1 0 0 test.c:7 1045066226: 3: 4106 2 4096 1 Total of 2 1045066226: 3: dumping not-freed pointers changed since 0: 1045066226: 3: not freed: '0x808f008|s1' (4096 bytes) from 'ra=0x280e57ec' 1045066226: 3: total-size count source 1045066226: 3: 4096 1 ra=0x280e57ec 1045066226: 3: 4096 1 Total of 1 1045066226: 3: unknown memory: 1 pointer, 4096 bytes Supposedly there is a 4096 byte memory leak. The same program on my Slackware Linux box reports no leaks. I'm using 4.7-RELEASE. Does anyone have any ideas? The same program on a friend's 4.5-RELEASE box reports a 1024 byte leak. Is dmalloc just not FreeBSD-friendly? Thanks sam To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message