fishy commented on code in PR #2946:
URL: https://github.com/apache/thrift/pull/2946#discussion_r1529318561


##########
lib/go/test/tests/string_parse_allocation_test.go:
##########
@@ -0,0 +1,43 @@
+package tests
+
+import (
+       "context"
+       "fmt"
+       "strings"
+       "testing"
+
+       
"github.com/apache/thrift/lib/go/test/gopath/src/stringparseallocationtest"
+       "github.com/apache/thrift/lib/go/thrift"
+)
+
+func TestSimpleJsonStringParse_Allocations(t *testing.T) {
+       byteAllocationLimit := 100 * 1024 // 100 KB
+       res := testing.Benchmark(BenchmarkSimpleJsonStringParse_Allocations)
+       if res.AllocedBytesPerOp() > int64(byteAllocationLimit) {
+               t.Errorf("Total memory allocation size too high: %d", 
res.AllocedBytesPerOp())

Review Comment:
   nit: also output what's the limit:
   ```suggestion
                t.Errorf("Total memory allocation size too high: %d (> %d)", 
res.AllocedBytesPerOp(), byteAllocationLimit)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to