Closed jogramming closed 5 years ago
So i see that the BorrowDecoder does in fact reset the cursor (and also allocates a new buffer?)
But i don't need pooling for my use case (have 1 decoder per long lasting connection) and introducing something i dont need into a hot spot isn't something i'm fond of.
At the moment, you must borrow a decoder and release it everytime you want to decode something. Maybe we could introduce a way to reset the decoder for those who want to reuse the same decoder multiple time. Like a ˋdec.Reset()` method.
I ended up forking it and resetting it at the end of each Decode call https://github.com/jonas747/gojay/commit/9081ac11e06c13f278632914f86a5bcf8e3c19a5
Seems to work perfectly for my use case.
Ok, I will close the issue but will create a milestone to add an exposed Reset
method.
Thanks
I'm running into a issue where the decoder is never releasing any memory, and just contiously eats up more and more as you decode, with all the mentions of pooling and reusing decoders, i'm assuming this should not be the case?
code to reproduce (it eats up ram pretty fast so i wouldn't run it for more than a couple seconds):