Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reuse decompressed buffer to avoid allocating buffer whenever a batch is read. Fixes #909 #920

merged 1 commit into from May 31, 2022


Copy link

@vmihailenco vmihailenco commented May 25, 2022

Fixes #909

Copy link

lizhifengones commented May 31, 2022

I have the same problem.

# go tool pprof -alloc_space
(pprof) top
Showing nodes accounting for 781.67MB, 92.64% of 843.73MB total
Dropped 146 nodes (cum <= 4.22MB)
Showing top 10 nodes out of 88
      flat  flat%   sum%        cum   cum%
  514.37MB 60.96% 60.96%   514.37MB 60.96%  bytes.makeSlice
  101.87MB 12.07% 73.04%   101.87MB 12.07%  kafka-comsume/pkg/variable.SetSyncPool.func1
   88.03MB 10.43% 83.47%    88.03MB 10.43%
      16MB  1.90% 85.37%   746.05MB 88.42%  kafka-comsume/pkg/kafka.(*KafkaComsumer).readKafkaMsgs

# Temporary memory is allocated for each batch
(pprof)list bytes.makeSlice
... ...
     bytes:  3.98MB
   55.80MB   bytes.makeSlice

Copy link

lizhifengones commented May 31, 2022

@nlsun PTAL

Copy link

@nlsun nlsun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

batch.Read(buf) allocates in readMessageV2
3 participants