Skip to content

mem: Avoid clearing new buffers and clear buffers from simpleBufferPools#8670

Merged
arjan-bal merged 2 commits intogrpc:masterfrom
arjan-bal:buffer-pool-clears
Oct 28, 2025
Merged

mem: Avoid clearing new buffers and clear buffers from simpleBufferPools#8670
arjan-bal merged 2 commits intogrpc:masterfrom
arjan-bal:buffer-pool-clears

Conversation

@arjan-bal
Copy link
Copy Markdown
Contributor

@arjan-bal arjan-bal commented Oct 23, 2025

RELEASE NOTES:

  • mem:
    • Avoid clearing buffers which newly allocated.
    • Clear large buffers (> 1MB) before re-using.

@arjan-bal arjan-bal requested review from dfawley and easwars October 23, 2025 20:24
@arjan-bal arjan-bal added Type: Bug Area: Transport Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features. labels Oct 23, 2025
@arjan-bal arjan-bal added this to the 1.77 Release milestone Oct 23, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.05%. Comparing base (f448a97) to head (c237d60).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8670      +/-   ##
==========================================
+ Coverage   81.97%   83.05%   +1.08%     
==========================================
  Files         417      417              
  Lines       40788    32296    -8492     
==========================================
- Hits        33435    26823    -6612     
+ Misses       5991     4093    -1898     
- Partials     1362     1380      +18     
Files with missing lines Coverage Δ
mem/buffer_pool.go 100.00% <100.00%> (ø)

... and 363 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfawley dfawley assigned arjan-bal and unassigned easwars and dfawley Oct 27, 2025
@arjan-bal arjan-bal changed the title mem: Avoid cleaning new buffers and clear buffers from simpleBufferPools mem: Avoid clearing new buffers and clear buffers from simpleBufferPools Oct 28, 2025
@arjan-bal arjan-bal merged commit 8ab0c82 into grpc:master Oct 28, 2025
17 of 21 checks passed
@arjan-bal arjan-bal deleted the buffer-pool-clears branch October 28, 2025 05:33
@ramaraochavali
Copy link
Copy Markdown

@arjan-bal is this any way related to #8500 - Would it by any chance help to fix this?

@arjan-bal
Copy link
Copy Markdown
Contributor Author

@arjan-bal is this any way related to #8500 - Would it by any chance help to fix this?

Hi @ramaraochavali, there isn't a bug in the buffer pool. The Go garbage collector (GC) can reclaim memory held by the pool. To specify a memory limit for the GC, you would need to set the GOMEMLIMIT environment variable.

That said, this change isn't intended to reduce the memory usage of the buffer pool. However, #8705, which isn't part of a tagged release yet, is expected to improve buffer reuse and reduce memory usage.

@ramaraochavali
Copy link
Copy Markdown

@arjan-bal Thank you. We do set GOMEMLIMIT (to limit of container set) in Istio but still seeing memory growth with this. May be we need to reduce that a bit?

Thank you for sharing the other fix #8705

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

Labels

Area: Transport Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features. Type: Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants