You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message Parent {
option (vtproto.mempool) = true;
repeated Child children = 1;
Child one = 2;
}
message Child {
option (vtproto.mempool) = true;
uint32 field = 1;
}
When calling ReturnToVTPool() on Parent it calls ResetVT on all children and then calls m.Reset()
func (m *Parent) ResetVT() {
for _, mm := range m.Children {
mm.ResetVT()
}
m.One.ReturnToVTPool()
m.Reset()
}
However m.Reset() allocates a new object and overwrites the existing object entirely:
func (x *Parent) Reset() {
*x = Parent{}
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 call Reset()?
The text was updated successfully, but these errors were encountered:
I'm fairly certain it is a bug. I commented about this in #35 (comment) 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.
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()
?The text was updated successfully, but these errors were encountered: