Skip to content

Add [[nodiscard]] to TCMalloc frontend, cache, and freelist headers. - #1277

Closed
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_993390901
Closed

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_993390901

Conversation

@copybara-service

Copy link
Copy Markdown

Add [[nodiscard]] to TCMalloc frontend, cache, and freelist headers.

Add [[nodiscard]] to pure queries, accessors, policy builders, allocations, and fallible capacity methods across TCMalloc's frontend and caching headers (tcmalloc_policy.h, central_freelist.h, transfer_cache.h, transfer_cache_internals.h, cpu_cache.h, thread_cache.h, static_vars.h, mock_static_forwarder.h, and mock_transfer_cache.h), and handle previously ignored return values at call sites:

  • Check the ShrinkCache return value in TransferCacheTest.PlunderShrinksLowWaterMark.
  • Explicitly ignore the HasSpareCapacity probe in FakeTransferCacheEnvironment::RandomlyPoke.
  • Explicitly ignore ThreadCache::GetCache() in TCMalloc_Internal_MarkThreadBusy.

Add `[[nodiscard]]` to pure queries, accessors, policy builders, allocations, and fallible capacity methods across TCMalloc's frontend and caching headers (`tcmalloc_policy.h`, `central_freelist.h`, `transfer_cache.h`, `transfer_cache_internals.h`, `cpu_cache.h`, `thread_cache.h`, `static_vars.h`, `mock_static_forwarder.h`, and `mock_transfer_cache.h`), and handle previously ignored return values at call sites:
- Check the `ShrinkCache` return value in `TransferCacheTest.PlunderShrinksLowWaterMark`.
- Explicitly ignore the `HasSpareCapacity` probe in `FakeTransferCacheEnvironment::RandomlyPoke`.
- Explicitly ignore `ThreadCache::GetCache()` in `TCMalloc_Internal_MarkThreadBusy`.

PiperOrigin-RevId: 993390901
@google-cla

google-cla Bot commented Oct 5, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service copybara-service Bot closed this Oct 10, 2026
@copybara-service
copybara-service Bot deleted the test_993390901 branch October 10, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants