Repository navigation
Add private_usage target to find_memleak - Enrich leak detection with a new measurement method. - #996
Merged
Merged
Conversation
…tter type safety.
…X2` structures; update memory info function argument types.
…tter type safety.
…n and add tests for validation.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #996 +/- ##
==========================================
- Coverage 91.74% 91.71% -0.04%
==========================================
Files 150 150
Lines 15380 15424 +44
==========================================
+ Hits 14111 14146 +35
- Misses 1269 1278 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #971
Summary
Add a new
targetargument tofind_memleak. It can now choose between"working_set"(the old way) and"private_usage"(a new way).The new way uses
PrivateUsagefromPROCESS_MEMORY_COUNTERS_EX/PROCESS_MEMORY_COUNTERS_EX2, which is the Commit Charge. This gives the test a second, better way to find memory leaks.Why
Until now,
find_memleakhad only one way to measure memory: the Working Set Size. This is the amount of memory that is now in the physical RAM. It is easy to change by other things, so a leak can be hidden.A real leak is memory that was committed but never freed. The Working Set Size does not show this well.
By adding
private_usage, the test can now measure all committed private memory, even if the pages are not in RAM right now. This is a stronger way to find leaks.It is not a replacement. It is an addition. Now the test has two methods, and the user can pick the better one.
Trade-offs: one more method, not a simpler one
Pros: Two ways to measure, so the test is harder to fool. The new way catches leaks that the old way can miss. The test suite is richer.
Cons: The new way needs new structures (
PROCESS_MEMORY_COUNTERS_EXandPROCESS_MEMORY_COUNTERS_EX2). It needs more code. On old Windows, it falls back to the basic structure.Justification
The change does not change the old behavior. It only adds a new choice. The old tests still pass.
The new tests check that the new way works and that a wrong target gives an error.
This is a small, safe step that makes the test method stronger.
Out of Scope
private_usagethe default target.working_setbehavior.