Re[2]: [Gc] GC_get_bytes_since_gc locks
Ivan Maidanski
ivmai at mail.ru
Wed Aug 24 11:49:05 PDT 2011
Hi Juanjo,
Now I don't understand. What is "data safe"? GC_get_total_bytes was made race-free at the same time when GC_get_bytes_since_gc was.
Regards.
24 08 2011, 19:14 Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com>:
> On Wed, Aug 24, 2011 at 5:04 PM, Andy Wingo <wingo at pobox.com> wrote:
>
> > But I think you are mistaken here, that call is not in a pre-GC hook, so
> > there's no deadlocking problem. Or are you saying that I should be
> > doing these
> >
> > > ./libguile/gc.c: heap_size = GC_get_heap_size ();
> > > ./libguile/gc.c: free_bytes = GC_get_free_bytes ();
> > > ./libguile/gc.c: bytes_since_gc = GC_get_bytes_since_gc ();
> > > with one that is not
> > > ./libguile/gc.c: total_bytes = GC_get_total_bytes ();
> >
> > within an alloc lock?
> >
>
> No, I am saying that the call to GC_get_total_bytes() is not data safe,
> because internally this function is not protected by a lock! :-) In other
> words, you are mixing functions that lock and guarantee you a data safe
> value, with a call that does neither of those. Wouldn't it be way more
> efficient if you could use the lock just once? Or none at all should it be
> safe to do that?
>
> Juanjo
>
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com
>
>
More information about the Gc
mailing list