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.
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: read free_memory when the event is captured, not only at SDK startup #1962
fix: read free_memory when the event is captured, not only at SDK startup #1962
Changes from 2 commits
b352c5b
67a225c
2f321ef
56c19a7
4336949
2b53bbd
f05bd6f
628dd39
b237658
588bd6d
72d4a8b
a48bdba
9c507a8
a114f78
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
h
: ThefreeMemory
insystemInfo
is cached. If you log the freeMemory like thisyou see that it doesn't change when you capture events.
SentryCrash uses this methods to get the free and usable memory
sentry-cocoa/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_System.m
Lines 191 to 213 in ce1b8d1
Ideally, I think we should call the same methods. We could make these functions available for internal usage by adding them to
SentryCrashMonitor_System.h
and then exposing them via the SentryCrashWrapper.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.
By switching to
SentryCrash.sharedInstance.systemInfo
like @brustolin suggested, we get the uncached value and adding the log indeed shows it does change. Do you think that is an acceptable fix, or do you want to call the freeMemory method like you suggested?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.
Really
SentryCrash.sharedInstance.systemInfo
is uncached? I would be surprised. It didn't work for me though.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.
My logs were definitely showing different values. With you they always shows the same?
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.
SentryCrash.sharedInstance.systemInfo
is uncachedSentryCrashWrapper.sharedInstance.systemInfo
is cachedThere 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.
Yeah that's what I am seeing as well
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.
SentryCrash.sharedInstance.systemInfo
has a lit bit of overhead because all of the information retrieved. Wondering if just exposing thefreeMemory
function is not a better solution.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.
Alrighty, done. Confirmed that it works by sending multiple events and errors, and seeing the value actually change. Now, how would we unit test this?