What is Nostr?
tef /
npub1ntn…2mle
2024-03-18 07:25:06

tef on Nostr: it's a reasonably well known trick to make reference counting concurrent, but i ...

it's a reasonably well known trick to make reference counting concurrent, but i learnt a cute little trick to handle reclamation safely

the well known trick? instead of immediately applying increments/decrements, record them in a buffer and hand them off to a singular thread to apply the changes. you don't have to do expensive atomic operations except to pass around the buffer

the cute trick? apply all the increments first, then the decrements, and if it's zero you know it's definitely free
Author Public Key
npub1ntnhyxw9s3jcu8qdeq4y92uytg26rdp5fxl2u5ymxfnc38pqlr4q622mle