[Gc] GC_get_bytes_since_gc locks
Juan Jose Garcia-Ripoll
juanjose.garciaripoll at googlemail.com
Wed Aug 24 08:08:32 PDT 2011
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 ();
>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20110824/6c3df018/attachment.htm
More information about the Gc
mailing list