Closed Stebalien closed 7 months ago
Question:
We give Deferred
to the user so the user would need to put it back in the pool (tends to be sketchy). By pooling bytes.Buffer
, we can control the full lifecycle and don't need to ask the user to explicitly free it.
We could put a bytes.Buffer
inside Deferred
, but:
bytes.Buffer
will always overallocate (for performance) and we don't have a great way of predicting the correct size. So, instead, copy once when we're done.We we're seeing 10x the memory usage expected in a network migration in Filecoin.