-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix: Profiling memory leak in std::thread #3061
Conversation
std::thread does not free the parameters that are passed to it correctly, fall back to pthread APIs.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3061 +/- ##
=============================================
- Coverage 88.859% 88.846% -0.013%
=============================================
Files 492 492
Lines 52994 53024 +30
Branches 18983 18997 +14
=============================================
+ Hits 47090 47110 +20
- Misses 4950 4955 +5
- Partials 954 959 +5
... and 7 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
c021422 | 1199.15 ms | 1222.20 ms | 23.05 ms |
d40512b | 1231.12 ms | 1244.54 ms | 13.42 ms |
3f366ee | 1244.49 ms | 1257.28 ms | 12.79 ms |
b2f82fa | 1237.78 ms | 1256.02 ms | 18.24 ms |
8f397a7 | 1230.10 ms | 1253.88 ms | 23.77 ms |
98a8c16 | 1206.40 ms | 1232.14 ms | 25.74 ms |
a6f8b18 | 1236.96 ms | 1240.14 ms | 3.18 ms |
7bc3c0d | 1259.74 ms | 1268.45 ms | 8.71 ms |
7e8d5fd | 1208.69 ms | 1228.14 ms | 19.45 ms |
cd3bfeb | 1226.61 ms | 1226.96 ms | 0.35 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
c021422 | 20.76 KiB | 435.64 KiB | 414.88 KiB |
d40512b | 20.76 KiB | 427.77 KiB | 407.00 KiB |
3f366ee | 20.76 KiB | 427.84 KiB | 407.08 KiB |
b2f82fa | 20.76 KiB | 419.62 KiB | 398.86 KiB |
8f397a7 | 20.76 KiB | 420.55 KiB | 399.79 KiB |
98a8c16 | 20.76 KiB | 431.00 KiB | 410.24 KiB |
a6f8b18 | 20.76 KiB | 431.87 KiB | 411.11 KiB |
7bc3c0d | 20.76 KiB | 427.35 KiB | 406.59 KiB |
7e8d5fd | 20.76 KiB | 435.50 KiB | 414.74 KiB |
cd3bfeb | 20.76 KiB | 425.77 KiB | 405.01 KiB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
📜 Description
This is a follow up to #3055 that fixes the final memory leak reported in #2980
std::thread
appears to have some kind of bug (or maybe we were using it incorrectly, but I don't understand how) that causes it to not free the parameters that were passed to the thread entry function. In this PR we switch to using thepthread
APIs directly and managing memory manually, which fixes the leak.💚 How did you test it?
Verified with Instruments that the leak no longer reproduces:
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps