This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Reducing memory consumption
- To: Marc Espie <espie at quatramaran dot ens dot fr>
- Subject: Re: Reducing memory consumption
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Tue, 21 Mar 2000 13:28:35 -0700
- cc: egcs-patches at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <200003212007.VAA04889@quatramaran.ens.fr>you write:
> >Very simple. We've created a partition in our memory space. ie, there
> >is the stuff that is managed by GC and the stuff that isn't. There
> >may be megabytes of contiguous memory held by GC waiting for reclaimation
> >but an xmalloc call can still fail.
>
> Call me stupid, but...
> how hard is it to trigger a gc if malloc fails ?
Difficult. Because of...
> Or is there a kind of `critical section' issue with the gc, that states
> that you can't call it everywhere you can call malloc ?
Yes. Aside from one or two special cases, GC can only be triggered between
optimization passes, whereas malloc can be called anytime.
> Or is the gc-reclaimed memory not really reclaimed for anything except gc,
> and in particular not usable for a malloc ?
Yes/no. It can be reclaimed, but pages are not immediately reclaimed. Instead
unused pages are held on for a little while and used to satisfy new
allocations.
We might be able to have a malloc failure trigger a release of all the pages
on the unused list.
jeff