-
-
Notifications
You must be signed in to change notification settings - Fork 329
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: Free memory returned by backtrace_symbols() in debug builds #3202
Conversation
This code is only compiled in debug builds, but we were forgetting to `free` the pointer returned by `backtrace_symbols`. The documentation (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/backtrace_symbols.3.html) says: > It is allocated using malloc() and should be released using free()
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3202 +/- ##
=============================================
- Coverage 89.190% 89.139% -0.051%
=============================================
Files 502 502
Lines 54034 54022 -12
Branches 19386 19376 -10
=============================================
- Hits 48193 48155 -38
- Misses 4988 5008 +20
- Partials 853 859 +6
... and 13 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
Checks out, only usage of that is under DEBUG builds.
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cbf6225 | 1221.73 ms | 1251.20 ms | 29.47 ms |
bd2afa6 | 1245.24 ms | 1263.18 ms | 17.94 ms |
11ccc16 | 1206.45 ms | 1225.60 ms | 19.15 ms |
28333b6 | 1247.29 ms | 1262.51 ms | 15.22 ms |
ff5c1d8 | 1244.30 ms | 1263.96 ms | 19.66 ms |
4654f66 | 1247.16 ms | 1263.96 ms | 16.80 ms |
3f366ee | 1242.28 ms | 1260.80 ms | 18.52 ms |
67460f4 | 1244.56 ms | 1255.96 ms | 11.40 ms |
8f397a7 | 1236.76 ms | 1256.76 ms | 20.00 ms |
1bf8571 | 1215.31 ms | 1232.48 ms | 17.17 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
cbf6225 | 20.76 KiB | 425.77 KiB | 405.00 KiB |
bd2afa6 | 20.76 KiB | 420.55 KiB | 399.79 KiB |
11ccc16 | 20.76 KiB | 431.71 KiB | 410.94 KiB |
28333b6 | 20.76 KiB | 424.69 KiB | 403.93 KiB |
ff5c1d8 | 20.76 KiB | 430.98 KiB | 410.22 KiB |
4654f66 | 20.76 KiB | 432.17 KiB | 411.41 KiB |
3f366ee | 20.76 KiB | 427.84 KiB | 407.08 KiB |
67460f4 | 20.76 KiB | 426.15 KiB | 405.39 KiB |
8f397a7 | 20.76 KiB | 420.55 KiB | 399.79 KiB |
1bf8571 | 20.76 KiB | 437.12 KiB | 416.36 KiB |
* fix: Free memory returned by backtrace_symbols() in debug builds This code is only compiled in debug builds, but we were forgetting to `free` the pointer returned by `backtrace_symbols`. The documentation (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/backtrace_symbols.3.html) says: > It is allocated using malloc() and should be released using free() * Update CHANGELOG.md
📜 Description
This code is only compiled in debug builds, but we were forgetting to
free
the pointer returned bybacktrace_symbols
. The documentation (https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/backtrace_symbols.3.html) says:💡 Motivation and Context
Customer reported a memory leak in a call to
backtrace_symbols
, this is the cause.💚 How did you test it?
Verify that the memory is freed and does not leak in a debug build.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps