Re[4]: [Gc] weak maps and libgc

Ivan Maidanski ivmai at mail.ru
Wed Oct 26 02:36:05 PDT 2011


Hi Hans,

What's your opinion of these 3 ideas?

PS. Anyway, it won't go into 7.2 branch.

Regards.

26 10 2011, 13:05 Andy Wingo <wingo at pobox.com>:
> Thanks for the thoughts, Ivan!
> 
> On Wed 26 Oct 2011 10:18, Ivan Maidanski <ivmai at mail.ru> writes:
> 
> > 26 10 2011, 00:06 Andy Wingo <wingo at pobox.com>:
> >>  (1) a variant of GC_register_disappearing_link that also
> >>      incremented an `unsigned long' somewhere in memory
> >
> > You mean statistic counter, right?
> > Good idea.
> 
> Yes, but ideally one that can be associated with a particular memory
> location.  So, collecting a weak reference in collection A would
> increment a counter associated with A, but not affect a counter
> associated with collection B.
> 
> > Is my understanding correct - you want to optimize the following:
> >
> > // assume GC_general_register_disappearing_link(&link, obj1);
> > ...
> > GC_unregister_disappearing_link(&link);
> > GC_general_register_disappearing_link(&link, obj2);
> >
> > Right? If yes, I don't mind again.
> 
> OK, great.  (Embarrassingly, late yesterday I realized that part of my
> overhead was caused by terrible flaws in my hash functions, causing
> extra collisions and thus reshuffling.  It's not often that you get to
> replace a hash function and speed up your program by 25%!)
> 
> >>  (3) It would be nice if there were a callback after GC.  It would let
> >>      me accurately measure the time in GC, for example.  This isn't
> >>      relevant to the current discussion though.
> >
> > What's about existing GC_set_start_callback?
> 
> That callback is tricky, because you can't do much in it.  But it is
> good for starting a timer.  Then you need a GC_set_stop_callback to stop
> the timer and record the time spent in GC.
> 
> Another thing a GC_set_stop_callback would be useful for would be
> statistical profiling of the causes of GC -- just sample the call stack
> in the stop callback.  Such a sampler is likely to allocate memory
> though and so it's not appropriate for a start callback.
> 
> Regards,
> 
> Andy
> --
> http://wingolog.org/
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 



More information about the Gc mailing list