Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 24481 invoked from network); 17 Feb 2010 18:04:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2010 18:04:20 -0000 Received: (qmail 48918 invoked by uid 500); 17 Feb 2010 18:04:19 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 48840 invoked by uid 500); 17 Feb 2010 18:04:19 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 48831 invoked by uid 99); 17 Feb 2010 18:04:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 18:04:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of trawick@gmail.com designates 209.85.217.215 as permitted sender) Received: from [209.85.217.215] (HELO mail-gx0-f215.google.com) (209.85.217.215) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Feb 2010 18:04:11 +0000 Received: by gxk7 with SMTP id 7so242203gxk.4 for ; Wed, 17 Feb 2010 10:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=gyJugadZYeaNfOHORqoYhKww6fiHqXUdlqUT4dnAJnk=; b=GWfTb/jzZz2Z9UtnMERyArlOzjb/trU/JIme3vvv35zNtnrW7LlP0yp5/lqutFv7Pc g0ZSoluqVe2MfhIGJHgLvgpTIqbQkGvTeRbC+L0Eb7oJgyL6X2oDZ7ByKqZHU96GzDyy N0NPm0Fr9r+iSv0fDqTT2mAyu5MD0G2IvVd9k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=JQkJo+D8gf0B8vGP+jvtcxIW1tjzeveVZR1K32dBijUc2EA01YUxeCyHjXYjmDetmL jUm8fh6k09zM3L/xG3I+Fk4fHsiNt/uHGdnzjXcvfHBE2NZGUItIAR/S8dlyWYWOkUuy UhBCEoPqq/Zs2g9B2mtA0lxRH3sh/W0iuOoRI= MIME-Version: 1.0 Received: by 10.101.170.15 with SMTP id x15mr4068900ano.68.1266429829195; Wed, 17 Feb 2010 10:03:49 -0800 (PST) In-Reply-To: References: <20100217161036.GA9086@redhat.com> Date: Wed, 17 Feb 2010 13:03:49 -0500 Message-ID: Subject: Re: Finding memory leaks in httpd and httpd modules From: Jeff Trawick To: dev@httpd.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Feb 17, 2010 at 12:17 PM, harish kulkarni wr= ote: > if you are seeing leaks while using apr memory allocation, it's better to > use apache pool debug > i am just pasting some portion of the debug logs which i used to debug > issue, this might help you. > In the following "request" means that you are allocated memory from reque= st > processing for given connection. > "proxy_conn_pool" means allocation happened from proxy connection pool. > I have found this is best approach to find leaks or allocation procedure = of > apache. > POOL DEBUG: [14983/3058834320] =A0PALLOC ( =A0 =A0 =A04463/ =A0 =A0 =A044= 63/ =A0 =A0143668) > 0x80ffee0 "request" (67/67/0) > POOL DEBUG: [14983/3058834320] =A0PALLOC ( =A0 =A0 =A0 =A081/ =A0 =A0 =A0= =A081/ =A0 =A0143685) > 0x814c038 "proxy_conn_pool" (2/7/1) > POOL DEBUG: [14983/3058834320] PCALLOC ( =A0 =A0 =A0 249/ =A0 =A0 =A0 249= / =A0 =A0143853) Thanks; I had largely forgotten about the nature of these logs. That makes it trivial to see when objects are allocated from the wrong pool, or find when some structure which has been unexpectedly reused/overlaid was originally allocated (and from which pool). I can't say for sure without being in a specific debug situation, but I'd probably start with finding what was calling brk() then if pool use seemed to be involved (vs. direct calls to the heap or apr allocator) and/or I got stuck and/or needed this kind of picture of pool use I'd rebuild/retest with pool debug and have a look at the log. (And that requires being able to reproduce it myself on my own binaries.)