Repository navigation
Add a self-test for find_memleak to reduce false positives from probe warmup. - #995
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #995 +/- ##
==========================================
+ Coverage 91.73% 91.74% +0.01%
==========================================
Files 149 150 +1
Lines 15357 15380 +23
==========================================
+ Hits 14088 14111 +23
Misses 1269 1269 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
junkmd
added a commit
to junkmd/comtypes
that referenced
this pull request
Nov 15, 2026
…be warmup. (enthought#995) * feat: Add type hints to `find_memleak`. * test: Add an initial unstable test. * test: Enhance `test_find_memleak` with `wss()` warmup to stabilize memory measurements. * test: Refactor comments in `test_find_memleak` for clarity on `wss()` usage.
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.
Summary
Add a self-test for the memory-leak diagnostic helper (
find_memleak/wss).The test checks a practical way to avoid one class of false positives: one-time costs of the first
wss()call in a process landing between the baseline and final readings insidefind_memleak.This is a small preparatory step before work on issue #971.
Motivation
find_memleaktakes a baseline with onewss()call and a final reading with another. The firstwss()call in a process can incur one-time costs (for example, pages being faulted in the first time certain code paths run). Those costs can appear as growth even when the function under test does not leak.Calling
wss()once beforehand pays that cost early, so the later measurement is less likely to report a false leak.This only warms up the probe itself. Warmup of the target function is already handled inside
find_memleak.This is a practical workaround. It does not fix the deeper limitation of Working Set–based measurement (see #971): a stable Working Set does not prove the absence of a leak.
Changes
Test_find_memleakthat exercises a known leak-free function (CoGetMallocalloc/free).wss()once beforefind_memleakso probe warmup does not pollute the measurement.Value