Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report actual bytes leaked/Fix realloc tracing #1053

Merged
merged 8 commits into from
Oct 3, 2023
Merged

Conversation

DmitriyMusatkin
Copy link
Contributor

@DmitriyMusatkin DmitriyMusatkin commented Aug 29, 2023

Issue #, if available:

Description of changes:
Report actual bytes leaked and not number of leaks as it says in the log message.

Fix the bug with memtracer keeping incorrect records for realloc.
Previous logic for tracking realloc usage was

  • realloc
  • untrack old
  • track new
    Problem with that was that memtrace realloc was not thread safe as a whole. Ex. say thread 1 does a realloc operation, it calls parent realloc and then thread 2 takes control and realloc reuses address that thread 1 just released and clobbers the records for that address, so when thread 1 gets control back, record for the address will have changed and thread 1 will update tracking data incorrectly.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (4c0a9f5) 82.22% compared to head (e4ee8e7) 82.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1053      +/-   ##
==========================================
- Coverage   82.22%   82.21%   -0.01%     
==========================================
  Files          52       52              
  Lines        5647     5646       -1     
==========================================
- Hits         4643     4642       -1     
  Misses       1004     1004              
Files Coverage Δ
source/memtrace.c 99.54% <100.00%> (ø)

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DmitriyMusatkin DmitriyMusatkin changed the title report actual bytes leaked Report actual bytes leaked/Fix realloc tracing Oct 3, 2023
@DmitriyMusatkin DmitriyMusatkin merged commit d09b75e into main Oct 3, 2023
51 checks passed
@DmitriyMusatkin DmitriyMusatkin deleted the leaked_bytes branch October 3, 2023 16:39
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.

4 participants