ExtensionObject copy method leads to memory issue
ExtensionObject copy for object is doing a shallow copy instead of a deep copy like the rest of the built in types. It may lead to memory issues (double clear, etc.) when the copy is used, particularly when stored in the address space on server side.
Since no copy method exist for complex types stored in ExtensionObject, a solution is to encode the extension object content during a copy to have a deep copy in ByteString form.