Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 3153 invoked from network); 16 Dec 2005 09:37:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Dec 2005 09:37:01 -0000 Received: (qmail 86951 invoked by uid 500); 16 Dec 2005 09:36:59 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 86912 invoked by uid 500); 16 Dec 2005 09:36:59 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 86901 invoked by uid 99); 16 Dec 2005 09:36:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2005 01:36:59 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.101.205.148] (HELO smtpgw.lexisnexis.de) (212.101.205.148) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2005 01:36:58 -0800 Received: from [10.122.1.76] (gw.lexisnexis.de [212.101.205.145]) by smtpgw.lexisnexis.de (Postfix) with ESMTP id 79A463E8730 for ; Fri, 16 Dec 2005 10:36:35 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v734) Content-Transfer-Encoding: 7bit Message-Id: <0AD293D8-9CD5-4E94-807F-AC4F670639F6@lexisnexis.de> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: dev@apr.apache.org From: Sebastian Morawietz Subject: Creating Root-Pools and apr_pool_cleanup_register Date: Fri, 16 Dec 2005 10:35:03 +0100 X-Mailer: Apple Mail (2.734) X-LexisNexis-MailScanner-Information: Please contact LNG-DE IT Support for more information X-LexisNexis-MailScanner: Found to be clean X-LexisNexis-MailScanner-From: sebastian.morawietz@lexisnexis.de X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hello, Quite a while ago I began migration a C-Application to use APR, first for file-io / locking only ( now also memory management and error- handling ). Since it is not really easy to integrate apr memory-management into an existing application ( changing all the function signatures to take and apr-pool etc. ) there are still some few functions, that create an apr-pool with NULL as parent-parameter. This works nice, until I was playing around with apr_pool_cleanup_register to free memory allocated on the heap by other library methods. In the Unit-tests I got application crashes (double free), which can generally be traced back to apr_terminate calling cleanup-methods, that were already called by apr_pool_destroy before, but _ONLY_, if there is more than one root-pool created. So my question is: Is it to be generally considered dangerous to have more than one root-pool in an application, or might there be another problem in my application, that I have to spend some extra-thinking on (this stuff is disgustingly hard to debug ;)? Greetings Sebastian