public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Giuliano Belinassi <giuliano.belinassi@usp.br>,gcc@gcc.gnu.org
Subject: Re: Threadsafe Garbage Collection allocation
Date: Sat, 29 Jun 2019 06:31:00 -0000	[thread overview]
Message-ID: <13E60EFC-34F3-4652-A39A-E86BA1B294E6@gmail.com> (raw)
In-Reply-To: <20190628204851.dtv4lphpjjnxld36@smtp.gmail.com>

On June 28, 2019 10:48:51 PM GMT+02:00, Giuliano Belinassi <giuliano.belinassi@usp.br> 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.

GC allocation will eventually call ggc_alloc_internal and manual freeing ggc_free. Collection goes via ggc_collect and is done only at specific points triggered from the pass manager. 

Richard. 

>Thank you for your support,
>Giuliano.

      parent reply	other threads:[~2019-06-29  6:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 20:48 Giuliano Belinassi
2019-06-28 21:20 ` Jeff Law
2019-06-29  6:31 ` Richard Biener [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13E60EFC-34F3-4652-A39A-E86BA1B294E6@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=giuliano.belinassi@usp.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).