Fork me on GitHub

have an aaaalmost working version of this integrated into tau.alpha, so SAB backed taus are automatically allocated and freed with usage. Pretty sweet.


yeah, it works


So there's really no compaction on the allocated state in this scheme. You just compact the references in the free index and allocate new stuff on the left-most free spaces available. Smallest free block that fits from the left wins.


And it assumes all allocations are read only. And any new writes to a datastructure will produce a new write over free space. So we can lean on this free index a little harder.


Could do a diff on the old-val and new-val on each swap!, then store only the new-diff on a new tau-block in mem, leaving the old val still there, then stitch it back together on read. Just leave the new address on the old block so they can be traced. But then we'd have to start tracking the old references and decide when to start free'ing them.


But rather than a diff, typed-array backed persistent datastructures for CLJS would be able to live right inside the arraybuffer.


It's own functional allocation scheme could probably make garbage collection pretty easy to track.


Also, keep in mind, SharedArrayBuffers are intended to be the interface between JS and WASM. I don't know as much about interoperating with C/C++ memory but we'll likely be talking to those libs in CLJS via SABs.