Skip to content

Conversation

roberttoyonaga
Copy link
Collaborator

@roberttoyonaga roberttoyonaga commented Aug 14, 2024

Summary

This is a simplified version of #8630
This PR adds virtual memory tracking, but makes the assumption that virtual memory is used neatly (no overlapping committed regions etc). Please see the javadoc in NativeMemoryTracking for more info.

Notes:
There's 3 approaches we could take with this simplified version.

  1. The approach in this PR. This is a middle ground between 2 and 3. Instrument at the caller level (ie in HeapChunkProvider). This makes the caller responsible for correct instrumentation.
  2. Get rid of "track" methods and NmtVirtualMemoryInfo. Instead, directly query HeapAccounting whenever we need to report virtual memory. This is probably less extensible than 1 or 3.
  3. Lower level instrumentation of VirtualMemoryProvider implementations. Similar to the original PR. This would ensure we don't miss any allocations if virtual memory becomes used in other places in the future. However, I don't think this is necessary right now since virtual memory is used simply in SVM currently. We can avoid instrumenting in platform specific code.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 14, 2024
@roberttoyonaga roberttoyonaga marked this pull request as ready for review August 14, 2024 22:25
@christianhaeubl christianhaeubl changed the title NMT simplified virtual memory tracking [GR-57310] NMT simplified virtual memory tracking. Aug 16, 2024
@roberttoyonaga
Copy link
Collaborator Author

Realized I needed to make a small change to consider all image heap regions when determining the size. I'm done making changes now.

@christianhaeubl
Copy link
Member

Thanks for the PR. I had to change a few things, so I opened another PR based on your changes: #9549.

@graalvmbot graalvmbot merged commit b448875 into oracle:master Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

native-image OCA Verified All contributors have signed the Oracle Contributor Agreement. redhat-interest

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants