From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32499 invoked by alias); 21 Oct 2011 06:09:46 -0000 Received: (qmail 32487 invoked by uid 22791); 21 Oct 2011 06:09:43 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC,TVD_RCVD_IP X-Spam-Check-By: sourceware.org Received: from 195-14-0-142.nuxit.net (HELO de558.ispfr.net) (195.14.0.142) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 21 Oct 2011 06:09:25 +0000 Received: from ours.starynkevitch.net ([213.41.244.95] helo=glinka.lesours) by de558.ispfr.net with smtp (Exim 4.72) (envelope-from ) id 1RH8IE-0006uW-NX; Fri, 21 Oct 2011 08:09:22 +0200 Date: Fri, 21 Oct 2011 09:03:00 -0000 From: Basile Starynkevitch To: gcc@gcc.gnu.org Cc: Marc Glisse Subject: Re: adding destroyable objects into Ggc Message-Id: <20111021080914.08528e83f5eb53897d92fee9@starynkevitch.net> In-Reply-To: References: <20111018171201.361304028ab94f102f827bd2@starynkevitch.net> <20111018191350.470cd6b1cd291373d5ff3f2c@starynkevitch.net> <20111020080753.a895eae452bb25e312ebf617@starynkevitch.net> <20111020081245.GA12085@ours.starynkevitch.net> <20111020085324.GA12472@ours.starynkevitch.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg00375.txt.bz2 On Thu, 20 Oct 2011 17:13:46 +0200 (CEST) Marc Glisse wrote: > Can't you use GTY-ed memory in PPL? Sorry for the naive question, but > std::vector can take an allocator parameter, gmp lets you specify an > allocation function... I believe that the PPL C++ code don't have any kind of allocator parameters. But I am not sure it would help. Let's take just a std::string allocated with an allocator that would use Ggc-ed memory, and appearing inside a GTY-ed data. How that Ggc-ed memory used for the string will be marked, and how will it be released? The usual way to release memory allocated by Ggc is inside ggc_collect (e.g. by sweep_pages) and that happens when the object has not been marked (because Ggc is a precise mark&sweep collector). And because C++ collections don't offer (AFAIK) any support to scan all their internal data (so if std::string implementation actually contains a pointer to some internal buffer which would have been Ggc-allocated because the string has been created using our putative Ggc C++ allocator) it seems to me that the only way to make it work is to have the C++ destructor of our std::string called from inside Ggc. This is what I call finalized objects (or destroyable objects) inside Ggc. Or did I not understood something about your question? Cheers -- Basile STARYNKEVITCH http://starynkevitch.net/Basile/ email: basilestarynkevitchnet mobile: +33 6 8501 2359 8, rue de la Faiencerie, 92340 Bourg La Reine, France *** opinions {are only mine, sont seulement les miennes} ***