From owner-freebsd-hackers@FreeBSD.ORG Sun Mar 6 04:32:00 2011 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 01A02106566C; Sun, 6 Mar 2011 04:32:00 +0000 (UTC) (envelope-from anderson@ttel.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4C1A68FC08; Sun, 6 Mar 2011 04:31:59 +0000 (UTC) Received: by gxk7 with SMTP id 7so1430064gxk.13 for ; Sat, 05 Mar 2011 20:31:58 -0800 (PST) Received: by 10.90.126.17 with SMTP id y17mr3099507agc.64.1299385918593; Sat, 05 Mar 2011 20:31:58 -0800 (PST) Received: from [10.0.7.145] (r74-193-70-198.pfvlcmta01.grtntx.tl.dh.suddenlink.net [74.193.70.198]) by mx.google.com with ESMTPS id w4sm1732043anw.16.2011.03.05.20.31.55 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 Mar 2011 20:31:57 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Eric Anderson In-Reply-To: Date: Sat, 5 Mar 2011 22:31:53 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <40A52D4A-9397-4406-A7EC-E7CBBEFADD55@freebsd.org> To: Eygene Ryabinkin X-Mailer: Apple Mail (2.1082) X-Mailman-Approved-At: Sun, 06 Mar 2011 06:40:46 +0000 Cc: freebsd-hackers@freebsd.org Subject: Re: Mem leak : malloc/free + pthreads = leakage? 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: Sun, 06 Mar 2011 04:32:00 -0000 On Mar 5, 2011, at 6:23 AM, Eygene Ryabinkin wrote: > Fri, Mar 04, 2011 at 10:02:45PM -0600, Eric Anderson wrote: >> I have a moderately threaded userland program (all C) I am working >> on (using pthreads, freebsd 8.1 64bit). It seems to leak memory >> (using standard malloc/free) badly. I am using pcap to capture >> packets and process them. I have a handful of libs statically linked >> in (pcap is one, the rest don't seem to matter - I can remove them >> and still see the leak). =20 >>=20 >> Does anyone know of issues regarding malloc/free on multithreaded >> userland apps? =20 >=20 > I personally hadn't heard about them, but you can definitely run > your program under Valgrind's memcheck tool -- it often does the > good amount of work and detects many leaks. Valrgind is ported > to FreeBSD, devel/valgrind. I tried valgrind from ports, however there were some missing syscalls = and such, and when I went to fill them in, could not figure out which it = was, and just could not make it fly. :( I also tried to make hoard work, but it seems to not be happy in ports = on 64bit FreeBSD. Thanks! Eric