@ngn concerning ref-counting errors, we discussed that some time again. I assume you know how much memory k has allocated at current time. But do you also know where the memory is (e.g. list of address ranges)?
@ngn but if you start with one big-enough region of memory and never grow, it's all k-memory? then you can iterate from the start over each block and see if it's in use. would that work?
@ngn to find errors with ref/unref. after each unit test, delete all variables, traverse all free blocks (mark them if needed), traverse all memory from block to block and see if it's really unused. if you find a used block, you forgot to unref.