2009/8/21 Paolo Bonzini <bonz...@gnu.org>:
>> Here tem should not be allocated on GC memory.
>
> I disagree, as this would not apply to tem only but also to anything
> allocated to fold it.  This is not going to be maintainable (what if fold
> create temporary types, which need to be in GC memory definitely?).

I see. I never investigated what is going on here in detail. If tem
were allocated in some obstack, I wouldn't see a problem with
allocating its subparts in the obstack too. However I know nothing
about those temp types that definitely should be in GC memory. Maybe I
will come up with something once I investigate this thoroughly. Maybe
this really has to stay as it is.

> Not having to deal with the lifetime of "temporary" stuff is part of having
> a GC, isn't it?

Yes - if you don't know the lifetime or if the lifetime varies. If
stuff has a fixed and short lifetime, then I guess non-GC allocation
is the best for it. Of course the goal is to have as simple and as
maintainable code as possible.

Maybe http://gcc.gnu.org/wiki/Memory_management needs some updates.

> At most, you may want to add more ggc_free calls, but I don't think this is
> necessary either.

I agree.

Anyway, right now I am not planning to see what can be done about
those types that are sometimes allocated in "a proper GC way" and
sometimes for scratch only. For the time being, I am working only on
those types that are allocated in GC while GC knows nothing about
them.

-- 
Laurynas

Reply via email to