Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C6u3U-0006wd-Q2 for qemu-devel@nongnu.org; Mon, 13 Sep 2004 12:51:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C6u3T-0006wR-9G for qemu-devel@nongnu.org; Mon, 13 Sep 2004 12:51:52 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C6u3T-0006wO-63 for qemu-devel@nongnu.org; Mon, 13 Sep 2004 12:51:51 -0400 Received: from [192.76.135.70] (helo=kurt.tools.de) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C6txr-000355-2d for qemu-devel@nongnu.org; Mon, 13 Sep 2004 12:46:03 -0400 Received: from tiger2.tools.intra (tiger2.tools.intra [172.20.0.11]) by kurt.tools.de (8.12.11/8.12.11) with ESMTP id i8DGk1KK026181 for ; Mon, 13 Sep 2004 18:46:01 +0200 (MEST) Received: from tiger2.tools.intra (tiger2.tools.intra [IPv6:2::20:208:c7ff:feaa:83b8]) by tiger2.tools.intra (8.12.10+Sun/8.12.10) with SMTP id i8DGk1WO020624 for ; Mon, 13 Sep 2004 18:46:01 +0200 (CEST) Message-Id: <200409131646.i8DGk1WO020624@tiger2.tools.intra> Date: Mon, 13 Sep 2004 18:46:01 +0200 (CEST) From: Juergen Keil MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Content-MD5: Fk416kw4aVOrbE0oDXKivg== Subject: [Qemu-devel] memory leak in user mode network stack Reply-To: Juergen Keil , qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, apparently there is a qemu memory leak when -user-net is used. ftp'ing a ~500Mbyte file from the host os to the guest os increases memory usage for the "qemu -m 256" process from ~280mb to almost 2gb. It seems the problem is in slirp/if.c, if_start(). If fetches queued mbuf's, sends them, but does not return the mbufs to the free mbuf pool. Shouldn't if_start() return mbufs to the free mbuf pool after transmitting the data, like this? Index: if.c =================================================================== RCS file: /cvsroot/qemu/qemu/slirp/if.c,v retrieving revision 1.1 diff -u -B -c -8 -r1.1 if.c cvs diff: conflicting specifications of output style *** if.c 22 Apr 2004 00:10:47 -0000 1.1 --- if.c 13 Sep 2004 16:29:32 -0000 *************** *** 310,320 **** --- 310,322 ---- if (--ifm->ifq_so->so_queued == 0) /* If there's no more queued, reset nqueued */ ifm->ifq_so->so_nqueued = 0; } /* Encapsulate the packet for sending */ if_encap(ifm->m_data, ifm->m_len); + m_free(ifm); + if (if_queued) goto again; }