From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Kemp Subject: Re: How to diagnose memory leak in kvm-qemu-0.14.0? Date: Fri, 20 May 2011 14:47:31 +0100 Message-ID: <20110520134731.GK27422@bytemark.co.uk> References: <20110518164429.GA20927@bytemark.co.uk> <20110519115734.GB3490@bytemark.co.uk> <20110520114707.GG27422@bytemark.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Stefan Hajnoczi Return-path: Received: from nog.sh.bytemark.co.uk ([212.110.161.168]:34204 "EHLO nog.sh.bytemark.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751828Ab1ETNrd (ORCPT ); Fri, 20 May 2011 09:47:33 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Fri May 20, 2011 at 14:16:05 +0100, Stefan Hajnoczi wrote: > > =A0I've had a quick read of hw/virtio-blk.c but didn't see anything > > =A0glaringly obvious. =A0I'll need to trace through the code, drink= more > > =A0coffee, or get lucky to narrow it down further. > > Enabling the memory allocation trace events and adding the > __builtin_return_address() to them should provide enough information > to catch the caller who is leaking memory. I'm trying to do that at the moment. So far the only thing I've done is add a trace on virtio_blk_alloc_request - I'm noticing a leak there pretty easily. I see *two* request structures be allocated all the time, one is used and freed, the other is ignored. That seems pretty conclusively wrong to me, but I'm trying to understand how that happens: virtio_blk_alloc_request 0.000 req=3D0x91e08f0 -> Allocation 1 virtio_blk_alloc_request 77.659 req=3D0x9215650 -> Allocation 2 virtio_blk_rw_complete 449.469 req=3D0x91e08f0 ret=3D0x0 -> First is u= sed. virtio_blk_req_complete 1.955 req=3D0x91e08f0 status=3D0x0 -> First is= freed. second is never seen again. Steve Kemp -- Bytemark Hosting http://www.bytemark.co.uk/ phone UK: 0845 004 3 004 Dedicated Linux hosts from 15ukp ($30) per month