Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
os x 10.9
Description
After a long time running go program base on compact protocol, I found that the memory is just increase and never drop. After using go tool pprof to check the memory usage, I found in `ReadStructBegin` it push `lastFieldId` to the slice p.lastField. But in `ReadStructEnd`, it just assign the last element in `p.lastField` to `lastFieldId` and do not pop the last element.
So the length of `p.lastField` is just increasing...
To fix the bug,we need to pop the last element as the patch shows below:
diff --git a/lib/go/thrift/compact_protocol.go b/lib/go/thrift/compact_protocol.go
index 74d36d0..f89fc2f 100644
— a/lib/go/thrift/compact_protocol.go
+++ b/lib/go/thrift/compact_protocol.go
@@ -352,6 +352,7 @@ func (p *TCompactProtocol) ReadStructBegin() (name string, err error) {
func (p *TCompactProtocol) ReadStructEnd() error