Closed dayllenger closed 4 years ago
I think I liked the other approach more (destroy on struct destructor) which was also less error prone
Well this code should be kinda faster, because e.g. insertCodeInContainer
may use the hot memory after calling getCodeBlockRange
.
we set a checkpoint after (hopefully) no memory here so when we rollback it's going to run identical code to what is in the destructor right now.
With this change there is risk for wrong usage, leaking memory in it.
However there might be an advantage if we allocate 1 byte at the start and always roll back to 1 byte because then it will actually keep the memory of the first page allocated. For this we need to do a proper benchmark though.
Damn, this is true. I thought (for whatever reason) that it will keep the last used page even if it's empty (edit: well, it keeps but not the very first one). I don't know how to correctly benchmark this project, so I'll pass.
Anyway.
Explodes with the current libdparse dependency.