-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
native image build should report RSS size of build process #3879
Comments
Caveat is that the RSS values might be lower than the repoted heap usage due to lazy commit. This can be worked-around by -XX:+AlwaysPreTouch JVM option. Closes oracle#3879
Instead of RSS, a portable way would be to report: Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() Would that work for your use cases? |
Thanks for the suggestion. I don't think this would work as both metrics [*] implemented as |
See also: #3913 (comment) |
As an observation the "memory usage" printed before this patch was the heap capacity retrieved via API Runtime.getRuntime().totalMemory(). The actual intent seemed to be to print the heap usage, retrievable with API: Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() This patch changes the output to dispaly heap usage instead. Additionally, the resident set size (rss) is being displayed for Linux. Other implementations may follow. Closes oracle#3879
@fniephaus I've changed the proposed PR to actually show heap usage (over capacity). This gives good diagnostic info on Linux. On other platforms we'd not loose any info - other than the heap(capacity) => heap(usage) change. Then again, I don't know how useful it is to show the heap capacity to begin with. Thoughts? |
Why is that a problem? You get several snapshots for a native image build and you can be sure that it will never pessimize heap consumption. On the other hand, heap capacity almost always does that as your graph shows. When somebody also looks at the RSS values it leaves the reader with lots of question marks as to what's going on when heap usage seems to be larger than RSS sometimes. |
Closing as this has been added with: e04a9cd |
Feature request
Add resident set size memory information to the native image build process for a more accurate picture of consumed memory.
Is your feature request related to a problem? Please describe.
We frequently analyze the native image build process for memory consumption. While it shows the current heap capacity (via
Runtime.getRuntime().totalMemory()
), but that's not the total picture as it only showing (some) heap information. There are other things consuming memory. Native GC structures, Class metadata, JIT compiler code caches, etc. This is particularly relevant on cloud systems where the build process might run with a memory limit and the native-image build process gets seemingly killed too early by the Linux OOM killer. The memory reporting of the native-image build process seemingly shows that there is still some room left. That can leave users confused.Describe the solution you'd like.
Include resident set size (RSS) of the processes' virtual memory in addition to heap consumption for the native image build process. Example:
Describe who do you think will benefit the most.
GraalVM users, GraalVM contributors, developers of libraries and frameworks which depend on GraalVM.
Describe alternatives you've considered.
I've done some experiments to hook this onto the existing native-image output. For Linux this can be done via:
but this isn't easy to put into all possible build pipelines. A GraalVM patch seems the better approach.
Express whether you'd like to help contributing this feature
Feel free to assign this feature request to myself. I'll get an initial version (for Linux) implemented. If relevant parties can show me the corresponding Windows/Mac APIs I'd be happy to incorporate.
The text was updated successfully, but these errors were encountered: