-
Notifications
You must be signed in to change notification settings - Fork 29
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
Memory monitoring is not so accurate (using RSS instead of the more accurate PSS) #11
Comments
Hi @shijiannihao, thanks for posting an issue! Do you have any examples of reporting that is inaccurate to show? What's the device/os version you're using? In my experience, Android Studio profiler actually increases the app memory consumption by a few dozens MB so it's usally a bit higher than the reality. Could also be related to #13 which could completely mess up measures for some devices |
Thanks @shijiannihao for the screenshots! 🙏 Right, this is quite off in this case. I think this is because we report RSS (Residential Set Size, reported also by Basically Android processes can share memory with other processes, so the PSS takes that into account by proportionally dividing the shared memory between the process that share it, while the RSS does not. So RSS > PSS (see https://elinux.org/Android_Memory_Usage#procrank for more explanation) Sure but which is the most accurate?PSS is said to be the most accurate representation of the program memory footprint (and is the one used by Android Studio, so hopefully they're not wrong) The Flipper plugin with RSS should still give a good value and should help detect potential memory leaks, however the baseline will always be higher than the value reported by Android Studio. I think we should still move to use PSS instead, however we have some issues:
PlanWhen the C++ profiler gets released, I think we can then, periodically run All in all, stay tuned! 🤞 |
Thank you very much for your reply |
I looked into #35 and got the gist that getting the PSS report had a significant impact on the device. I used the |
Hey @MalcolmTomisin, thanks for taking the time to try that out! Correct me if I'm wrong, but in your case, would |
Hi @Almouro, Still looks like there's minimal impact on CPU, but what would be the key condition for Flashlight to start reporting memory usage based on PSS? |
@MalcolmTomisin oh very interesting! I think the original idea from #35 might still hold then, aka running a background thread capturing the PSS memory every 1s, though I don't necessarily think it was super well implemented The only remaining issue would be what to do for the first measures. At the moment, Flashlight polls measures every 500ms, but if the first RAM measure takes more than 1 or 2s to come, that could be annoying. We might just be able So technical strat should be something like:
|
I tried the above and understood why you didn't choose this route; the impact on performance of running a separate thread getting snapshots of PSS reports was not insignificant. Furthermore, it introduced noise to the live profiling. 😞 I wonder how Android studio is able to report PSS memory. 🤔 |
It is found that memory monitoring is less accurate than Android studio profiler memory monitoring?
The text was updated successfully, but these errors were encountered: