Hello,
We’ve come across a potential memory leak after creating serializers based off TPolymorphicStructNetSerializerImpl for our own project. We noticed that items(ExternalSourceType), whose serializers themselves contain dynamic state, do not have their dynamic state freed during TPolymorphicStructNetSerializerImpl::Quantize when freeing the memory of TargetValue.StructData.
TPolymorphicStructNetSerializerImpl::DeserializeDelta, and TPolymorphicStructNetSerializerImpl::Deserialize both call InternalFreeItem to invoke FreeDynamicState on the dynamic state, before freeing the memory of Target.StructData, but TPolymorphicStructNetSerializerImpl::Quantize only calls FPolymorphicStructNetSerializerInternal::Free(Context, TargetValue.StructData). This doesn’t give TargetValue.StructData the chance to free their own dynamic state if it has any, causing it to never be free’d.
Can you confirm that this is the case, or is our understanding missing something about the way these serializers work? Looking at other serializers such as the one for FInstancedStruct, shows ::Quantize invoking FreeDynamicState prior to freeing the memory.
With kind regards,
Thank you for your time,
Céleste Neukirchen
[Attachment Removed]