Conversation
Signed-off-by: Tony Gorez <gorez.tony@gmail.com>
kasperisager
left a comment
There was a problem hiding this comment.
I'd detach the state buffer instead, storing additional state in a global map isn't a little iffy.
Yeah I forgot to let a comment, but I was not sure about how to approach it. |
Signed-off-by: Tony Gorez <gorez.tony@gmail.com>
Signed-off-by: Tony Gorez <gorez.tony@gmail.com>
kasperisager
left a comment
There was a problem hiding this comment.
Ah, come to think of it we aren't actually allowed to detach the buffer as we might not own the full ArrayBuffer allocation. I wonder if we can zero the state instead.
Oh ownership is an important point that I did not consider in the first place. Thanks for raising it! ;) Lets try that approach :) |
@kasperisager How would you check that? assert(state.some((b) => b !== 0), 'state has already been finalized')... but sounds like suboptimal ... Maybe adding a new props to the object like |
|
This is a case I'd leave as UB. We wouldn't be guarding against memory access violations in any event. |
|
Yeah lets close it ;) |
Output: