RE: [Gc] Changing ‘GC_should_collect’ to account for malloc’d memory
Boehm, Hans
hans.boehm at hp.com
Tue Mar 1 18:06:23 PST 2011
Presumably the test could be something like
<iconv_t structs allocd since last GC>*<sizeof iconv_t etc.> greater than GC_get_heap_size()/N
for some value of N, analogous to GC_free_space_divisor ?
If that works, then this doesn't sound so bad. You probably still need a rough guess of the space used by iconv_t.
Hans
> -----Original Message-----
> From: Ludovic Courtès [mailto:ludo at gnu.org]
> Sent: Tuesday, March 01, 2011 2:27 PM
> To: Boehm, Hans
> Cc: Bruce Hoult; Andy Wingo; gc at linux.hpl.hp.com
> Subject: Re: [Gc] Changing ‘GC_should_collect’ to account for malloc’d
> memory
>
> Hi,
>
> "Boehm, Hans" <hans.boehm at hp.com> writes:
>
> > Another approach might be to view the iconv_t structures as a second
> kind of
> > resource that's managed by the collector. If user code keeps track
> of how
> > many such structures are currently in use, it could decide that
> enough
> > iconv_t structures have been allocated since the last GC to warrant a
> > collection, independent of the GC heap situation.
>
> That would be an option.
>
> However, I’m concerned that choosing the number of iconv_t structures
> that warrant a collection would be black art since developers may have
> few clues to make a good decision, especially in the iconv_t example.
> As a result, garbage collection could happen too frequently.
>
> What do you think?
>
> Thanks,
> Ludo’.
More information about the Gc
mailing list