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

Question about memory usage of the binary zephyr.exe #33609

Closed
nqduy35 opened this issue Mar 23, 2021 · 4 comments
Closed

Question about memory usage of the binary zephyr.exe #33609

nqduy35 opened this issue Mar 23, 2021 · 4 comments
Assignees
Labels
area: native port Host native arch port (native_sim)

Comments

@nqduy35
Copy link

nqduy35 commented Mar 23, 2021

I'm new with Zephyr OS, so my question is very basic. I built a hello_world program for the native_posix board. I want to know the RAM usage of my program, then I tried to use the two following approaches:
(1) Running $ west build -t ram_report as presented in here. The result is 5242 B (~5 KB).
(2) Running $ west build -t run , then uses the ps tool to check the RSS (physical memory consuming) with the command $ ps aux | grep zephyr.exe. The result is 1104 KB (~1.1 MB).

How should I understand these two results. Thank you in advance.

@carlescufi carlescufi added question area: native port Host native arch port (native_sim) labels Mar 23, 2021
@aescolar
Copy link
Member

ram_report for posix arch boards (including native_posix) does not do anything (of any use).
When you build targetting native_posix, your code is built linked to several host shared libraries (including the C library), so the total memory usage reported by ps or other similar tools is going to be quite big (when accounting for the total of those shared libraries in memory).
Given that when you build for native_posix, you build a normal linux program, you can use normal linux tools to check its memory usage. The results will be "correct", but the output may not be too useful depending on what you are trying to do.

@nqduy35
Copy link
Author

nqduy35 commented Mar 24, 2021

Thank @aescolar for the answer. Regarding your answer, when I want to build my hello_world program to another board NOT posix arch (e.g. nrf52 DK), then I can use ram_report to calculate the actual RAM required by the program as it is run on the physical device? In fact, I don't have the device at this moment, but I need to calculate the RAM footprint.

@aescolar
Copy link
Member

when I want to build my hello_world program to another board NOT posix arch (e.g. nrf52 DK), then I can use ram_report to calculate the actual RAM required by the program as it is run on the physical device?

yes, you just need to build for the actual target you will use

@nqduy35
Copy link
Author

nqduy35 commented Mar 24, 2021

It is clear to me now. Many thanks to @aescolar and @carlescufi. I close the issue.

@nqduy35 nqduy35 closed this as completed Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: native port Host native arch port (native_sim)
Projects
None yet
Development

No branches or pull requests

3 participants