Open joe-elliott opened 1 year ago
I'm fairly certain it is a bug. I commented about this in https://github.com/planetscale/vtprotobuf/pull/35#issuecomment-1133384043 since I saw this behavior when trying to compile using the v0.3.0
tag. I'm still using v0.2.0
right now because of it.
I believe the solution is to use a fallthrough
here https://github.com/planetscale/vtprotobuf/blob/96ede25e29a0325741fd05d6e9e48364d65ea137/features/pool/pool.go#L64C8-L64C8
Using this proto:
When calling
ReturnToVTPool()
on Parent it callsResetVT
on all children and then callsm.Reset()
However
m.Reset()
allocates a new object and overwrites the existing object entirely:This nils out all fields on the parent throwing away the slice for the GC to handle. Am I missing something? Is there some way to put back into the pool, call
ResetVT()
but not callReset()
?