From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] block: Free iovec arrays allocated by multiwrite_merge() Date: Sun, 25 Apr 2010 16:35:29 +0300 Message-ID: <4BD44521.6040706@redhat.com> References: <4BD43747.1070403@redhat.com> <1272202054-4831-1-git-send-email-stefanha@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Leszek Urbanski , Ryan Harper , kvm@vger.kernel.org, Stefan Hajnoczi To: Stefan Hajnoczi Return-path: Received: from mx1.redhat.com ([209.132.183.28]:51011 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753475Ab0DYNfi (ORCPT ); Sun, 25 Apr 2010 09:35:38 -0400 In-Reply-To: <1272202054-4831-1-git-send-email-stefanha@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/25/2010 04:27 PM, Stefan Hajnoczi wrote: > From: Stefan Hajnoczi > > The MALLOC_TRACE output didn't look useful when I tried it either. > > Instead I used the following to find origin of the leak. Still very basic but > works better with qemu_malloc() and friends. > > This is just a hack but I wanted to share it in case someone finds it useful in > the future. > > new file mode 100644 > index 0000000..a5fa51a > --- /dev/null > +++ b/leakcheck.c > @@ -0,0 +1,17 @@ > +#include > + > +static FILE *fp; > + > +extern void leakcheck_log(char action, void *old_addr, void *addr, size_t size, void *ret1); > + > +void leakcheck_log(char action, void *old_addr, void *addr, size_t size, void *ret1) > +{ > + if (!fp) { > + fp = fopen("/tmp/leakcheck.log", "w"); > + if (!fp) { > + return; > + } > + } > use backtrace(3) or backtrace_symbols(3), or even better, an external tool? -- error compiling committee.c: too many arguments to function