diff options
Diffstat (limited to 'pkg/state/encode.go')
-rw-r--r-- | pkg/state/encode.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/state/encode.go b/pkg/state/encode.go index 59914bef4..fd052db12 100644 --- a/pkg/state/encode.go +++ b/pkg/state/encode.go @@ -335,6 +335,12 @@ func (es *encodeState) encodeObject(obj reflect.Value, mapAsValue bool, format s object = &pb.Object{Value: &pb.Object_MapValue{es.encodeMap(obj)}} } else { // Encode a reference to the map. + // + // Remove the map object count here to avoid double + // counting, as this object will be counted again when + // it gets processed later. We do not add a reference + // count as the reference is artificial. + es.stats.Remove(obj) object = &pb.Object{Value: &pb.Object_RefValue{es.register(obj)}} } default: |