10-22-08 - 4

I keep being told RefCounting is bad for threads. Really? I mean obviously if you do something retarded like mutex to touch the refcount that's bad, but you don't need to do that, you can just InterlockedIncrement. Also if you pass them around by value all the time so that the ref count goes up and down all time, that would be bad, but you don't need to do that either. I just want a way to have objects count the # of people that want them to stick around.

I'm thinking about making the strings in Oodle refcounted. Currently I just use char buffers everywhere, but that's awfully fat and I spend time strcpy'ing them around. So I could make them COW refcounted thingies and I think it just works. Another option would be to have a big static dictionary of every filename ever, and then I can just pass around read-only char *'s to that dictionary. That's actually a good solution *if* you are using most of those strings at any time, but could be very bad if you are generally only using a few of them at any one time.

No comments:

old rants