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: Collecting more frequently


> Date: Sat, 18 Mar 2000 00:06:00 +0100
> From: "Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de>

> You'll notice that peak memory consumption is much lower now, and
> that time spent in collection is higher.

> I propose that garbage collection happens more frequently in the
> 'parsing' stage of input file processing. Calling it as often as
> above is perhaps not reasonable, since there is not that much new
> garbage every time. So instead, I propose that the threshold is
> higher, e.g. collection should occur after each extdef only when the
> memory consumption has doubled or tripled since the last collection.

If you want an easy way to make your change more reasonable, without
do any real work, you can just collect less often: { static int i; if
(++i % 20 == 19) gc_collect(); }.  Then you just have to find a
reasonable N.  Simple, but better than blowing out memory by not
collecting.

If your adventuresome, then a scheme that finds out how close the
machine is to paging, and then collecting on demand might be the most
optimal scheme, but this is far from portable and does introduce some
non-repeatability into the compiler that some us us would hate to see
go.

Anyway, sounds like your on the right track.

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