This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Threadsafe Garbage Collection allocation
- From: Jeff Law <law at redhat dot com>
- To: Giuliano Belinassi <giuliano dot belinassi at usp dot br>, gcc at gcc dot gnu dot org, richard dot guenther at gmail dot com
- Date: Fri, 28 Jun 2019 15:20:06 -0600
- Subject: Re: Threadsafe Garbage Collection allocation
- References: <20190628204851.dtv4lphpjjnxld36@smtp.gmail.com>
On 6/28/19 2:48 PM, Giuliano Belinassi wrote:
> Hi,
>
> ***
> Question: What are all the possible ways to allocate and deallocate memory
> through the Garbage Collector?
> ***
>
> Context: I am parallelizing GCC internals and I am facing problems with the GCC
> Garbage Collector, and therefore I need to make it threadsafe to continue with
> the project.
>
> Currently, I want to do a palliative solution to this, which is locking a mutex
> every time a chunk of memory is allocated or deallocated. For this, I need to
> know all the possibilities to allocate and deallocate memory and lock/unlock
> the mutex there.
>
> As far as I have seen, there are the macros XALLOC, XNEW, XNEWVEC... defined in
> libiberty.h which are called everywhere in GCC, but I don't know if these are
> the only ways to allocate memory in GCC through the Garbage Collector.
Those allocate via malloc, not the GC system.
ggc_alloc is where you want to be looking.
jeff