From owner-freebsd-hackers@FreeBSD.ORG Sat Mar 5 17:01:22 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 A071D106566B for ; Sat, 5 Mar 2011 17:01:22 +0000 (UTC) (envelope-from myself@rojer.pp.ru) Received: from wooster.rojer.pp.ru (wooster.rojer.pp.ru [80.68.242.188]) by mx1.freebsd.org (Postfix) with ESMTP id 52DAD8FC0A for ; Sat, 5 Mar 2011 17:01:22 +0000 (UTC) Received: from wooster.rojer.pp.ru (localhost [127.0.0.1]) by wooster.rojer.pp.ru (Postfix) with ESMTP id C05691145A; Sat, 5 Mar 2011 19:45:11 +0300 (MSK) X-Spam-Checker-Version: SpamAssassin 3.3.1-rojer (2010-03-16) on wooster.rojer.pp.ru X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1-rojer X-Spam-Level: Received: from [192.168.10.20] (87-198-218-130.static.ptr.magnet.ie [87.198.218.130]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by wooster.rojer.pp.ru (Postfix) with ESMTPSA id B38401147E; Sat, 5 Mar 2011 19:45:07 +0300 (MSK) Message-ID: <4D726887.5080800@rojer.pp.ru> Date: Sat, 05 Mar 2011 16:44:55 +0000 From: Deomid Ryabkov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: Eric Anderson References: <40A52D4A-9397-4406-A7EC-E7CBBEFADD55@freebsd.org> In-Reply-To: <40A52D4A-9397-4406-A7EC-E7CBBEFADD55@freebsd.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit 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: Sat, 05 Mar 2011 17:01:22 -0000 On 03/05/2011 04:02 AM, Eric Anderson wrote: > Hi all, > > 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. as opposed to what? OpenBSD? Linux? Windows? why do you think your problem is specific to FreeBSD (as evidenced by your post to a FreeBSD-specific list) or is related to threaded programs? > 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). > > Does anyone know of issues regarding malloc/free on multithreaded userland apps? hell yeah. it goes like this: you malloc() then forget to free() - boom, you have a memory leak. you're welcome. sarcasm aside, those questions still remain: why do you think os/libraries are the problem and not your code? you can't post all of it, ok, and we don't want all of it either. can you isolate a specific example of where valid usage of a library causes a leak? > Sorry, I can't post the code.. > > Thanks! > Eric > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- Deomid "rojer" Ryabkov myself@rojer.pp.ru ICQ: 8025844