richardtech (richardtech) wrote,
richardtech
richardtech

Some notes on reference counting

Firstly, I've learnt a lot about memory barriers and suchlike over the weekend - this thread safe reference counting thing isn't as easy as it sounds... Also my ability to deal with assembly has definitely improved; I managed to replicate the solution used in the debian package to resolve bug #321291, before realising that I should probably just use the source from the debian tarball of libatomic-ops-dev, instead of the slightly older upstream.

Secondly, the documentation of the meaning of the constraints used by GCC's inline assembly syntax is very poor.

Thirdly, if you want to learn about this sort of thing, you could do worse than following lots of links from Hans Boehm's page at hp.com.

One thought that reading that brought up: I've often thought that one of the good things about reference counting (as opposed to other garbage collection schemes) is that you don't get unpredicatable large pauses for memory allocation. However what about recursive data structures? When a thread unreferences a large recursive datastructure such that the reference goes to zero, this can cause a large pause as the datastructure is recursively unreferenced, and deallocated. I suppose at least the pause is relatively predictable in this case - assuming that you know the datastructure was large to begin with, which you might well not.
  • Post a new comment

    Error

    default userpic
  • 0 comments