This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PCH, and more generally C++ parser performance


> (2) Garbage collection.  Here the relevant question is, how much
> memory are we using?  I instrumented mmap() and brk() and I have
> pretty graphs which you can have if you're interested.  But this test
> case is pretty darn pathological for memory usage.  We free very
> little memory over the course of the run, and at the end we're using
> 45 megabytes of mmapped anonymous memory, plus nine allocated with
> brk.  When you count program text, libraries, daemons, and kernel
> space memory, this test case is going to need more than 64 megs of
> RAM.  I have 256, it didn't hit swap space on my system, but it will
> on many people's.

Well, obviously you need enough physical memory to start with.
In order to avoid unnecessary allocations, I propose to only do GC if
either:

- the amount of newly allocated memory is at least X % + Y of the total
  allocated memory after the last GC (or at program start if there was
  no GC yet).  X should be something in the range of 10..100

or:

- The total amount of allocated memory is at least A, and the wall clock
  time spent since the last GC is at least B % of the wall clock time spent
  in the last GC.  B should be something in the range of 50..500%

The idea here is that if we are running into swapping, you see the wall clock
time skyrocketing.  It then makes sense to try to eliminate some memory
use after enough memory accesses have been made that might have released
some memory.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]