From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 26 23:32:13 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A1BF1065673 for ; Fri, 26 Dec 2008 23:32:13 +0000 (UTC) (envelope-from laladelausanne@gmail.com) Received: from mail-bw0-f19.google.com (mail-bw0-f19.google.com [209.85.218.19]) by mx1.freebsd.org (Postfix) with ESMTP id 226A48FC0C for ; Fri, 26 Dec 2008 23:32:12 +0000 (UTC) (envelope-from laladelausanne@gmail.com) Received: by bwz12 with SMTP id 12so10819057bwz.19 for ; Fri, 26 Dec 2008 15:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=s4KiqVNt8B/U+juXwLAub7g3QUBEFmqwVh93y+6vPk0=; b=gTxK1AkyQFL0jXrD/MdbcjppckGxTwP5Y+GKVnnrzXSPdvwyjHNNT0qFwNocDGzyq3 3rTUl6Ba8pRsi4x82erZSzRWjk3Okmmc68n4MPAG0VWx7A7NWED9/Thqsts3pbj3ig0G J42ruCFYvfVLhB3sxbmsur7jFFTyiwwl2Q05U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=DN5ISrUpxw2Ez7ByCWpFif3mdRmldBjw71+cKB7VYEfxOY82ah+GbeO1ErcR+CZeb4 wTwZOzJcA7RC1czYnUFQxZ4ktm5yWoiYkZp9HLNbwYXU2bbN7UE/+z678derMv+PbLZe XgMAArmuWRKNG5anDs+zmlYBBNNkQUSTreX0o= Received: by 10.103.192.10 with SMTP id u10mr1112968mup.101.1230334331717; Fri, 26 Dec 2008 15:32:11 -0800 (PST) Received: from ?192.168.1.11? (dyn.144-85-136-010.dsl.vtx.ch [144.85.136.10]) by mx.google.com with ESMTPS id s10sm27141092mue.43.2008.12.26.15.32.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 26 Dec 2008 15:32:11 -0800 (PST) Message-Id: <623D1024-5DA0-4252-8DA9-FA86E0407DA8@gmail.com> From: =?UTF-8?Q?Nikola_Kne=C5=BEevi=C4=87?= To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Date: Sat, 27 Dec 2008 00:32:09 +0100 X-Mailer: Apple Mail (2.930.3) Subject: debugging mbuf allocation/dealocation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2008 23:32:13 -0000 Hi, I'm trying to make some code which uses a lot of mbufs (Click modular router) running under FreeBSD 7.1. The problem is that it is leaking mbufs, and I can't find where... After running the Click in a configuration which generates 150k packets (using m_dup) and discards them (m_freem), I get this in netstat -m output: 150258/1302/151560 mbufs in use (current/cache/total) 256/828/1084/4672 mbuf clusters in use (current/cache/total/max) 256/768 mbuf+clusters out of packet secondary zone in use (current/ cache) 0/135/135/2336 4k (page size) jumbo clusters in use (current/cache/ total/max) 0/0/0/1168 9k jumbo clusters in use (current/cache/total/max) 0/0/0/584 16k jumbo clusters in use (current/cache/total/max) 38076K/2521K/40598K bytes allocated to network (current/cache/total) 0/0/0 requests for mbufs denied (mbufs/clusters/mbuf+clusters) 0/0/0 requests for jumbo clusters denied (4k/9k/16k) 0/0/0 sfbufs in use (current/peak/max) 0 requests for sfbufs denied 0 requests for sfbufs delayed 0 requests for I/O initiated by sendfile 0 calls to protocol drain routines So, my question is: how to debug this? How can I track the usage of mbufs, profile it, and such? I'm running Click as a kernel module. Thanks, Nikola