Skip to content

memory/jemalloc: Fix reserved memory accounting - #48472

Merged
phlax merged 3 commits into
envoyproxy:mainfrom
phlax:jemalloc-assign
Oct 21, 2026
Merged

phlax merged 3 commits into
envoyproxy:mainfrom
phlax:jemalloc-assign

Conversation

@phlax

@phlax phlax commented Oct 20, 2026

Copy link
Copy Markdown
Member

No description provided.

// After destruction, there should be no leaks. We allow 4096 bytes for allocator caches.
// We use EXPECT_LE directly here to bypass the strict EXPECT_GT constraint of EXPECT_MEMORY_LE.
EXPECT_LE(memory_test.consumedBytes(), 4096);
EXPECT_LE(static_cast<int64_t>(memory_test.consumedBytes()), 4096);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this cast needed here? is it related to the fix in the pr?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah - jemalloc testing fails without it - this was the botsplanation that i didnt pick when adding this - but happy to add it

// Cast to signed: under jemalloc the allocator may release unrelated cached memory during the
// churn above, so the net delta can legitimately be negative.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

got it, could you add explanatory comment (why the cast is needed)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

argh - just realized this will fail format - will fix ...

Signed-off-by: Ryan Northey <[email protected]>
nezdolik
nezdolik previously approved these changes Oct 21, 2026
@phlax
phlax enabled auto-merge (squash) October 21, 2026 12:29
Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax merged commit d5005ca into envoyproxy:main Oct 21, 2026
27 checks passed
phlax added a commit to phlax/envoy that referenced this pull request Nov 6, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 6, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 9, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
jwendell pushed a commit that referenced this pull request Nov 11, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 12, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit to phlax/envoy that referenced this pull request Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
phlax added a commit that referenced this pull request Nov 17, 2026
Signed-off-by: Ryan Northey <[email protected]>
(cherry picked from commit d5005ca)
Signed-off-by: Ryan Northey <[email protected]>
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.

3 participants