On Thu, 20 Oct 2011 17:13:46 +0200 (CEST)
Marc Glisse <marc.gli...@inria.fr> 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: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***

Reply via email to