-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8334026: Provide a diagnostic PrintMemoryMapAtExit switch on Linux #19660
8334026: Provide a diagnostic PrintMemoryMapAtExit switch on Linux #19660
Conversation
👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into |
@tstuefe This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 91 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
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.
Seems quite reasonable. One query and a couple of minor nits.
Thanks
ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( | ||
"-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintMemoryMapAtExit", | ||
"-XX:NativeMemoryTracking=summary", "-version"); |
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.
Nit: indentation is off here.
output.shouldContain("Memory mappings"); | ||
output.shouldContain("JAVAHEAP"); | ||
output.shouldHaveExitValue(0); |
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.
Suggestion: check the exit value first. If we crashed then the other checks will likely fail before we get here.
@@ -203,6 +204,8 @@ static void print_thread_details(uintx thread_id, const char* name, outputStream | |||
// Given a region [from, to), if it intersects a known thread stack, print detail infos about that thread. | |||
static void print_thread_details_for_supposed_stack_address(const void* from, const void* to, outputStream* st) { | |||
|
|||
ResourceMark rm; |
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.
Why was this needed to be added here? Shouldn't callers have any needed ResourceMarks?
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.
It is needed because in this function we call Thread::name() which for java threads returns an RA-allocated string. This issue popped up now because we are called without a ResourceMark at VM exit. I have not investigated closer since I think the Resourcemark makes sense here: The function does not export any RA-allocated memory but may be called in a loop many times.
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.
Okay. I was trying to find where the existing callers have their RM and it is not obvious.
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.
Existing caller is DCmd::parse_and_execute, where we have an RM that guards every individual Dcmd execution. So, this had been a small leak of sorts, since we accumulate thread names for all java threads printed.
Thanks @dholmes-ora ! I worked in your remarks. |
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.
Looks good. Thanks
@@ -203,6 +204,8 @@ static void print_thread_details(uintx thread_id, const char* name, outputStream | |||
// Given a region [from, to), if it intersects a known thread stack, print detail infos about that thread. | |||
static void print_thread_details_for_supposed_stack_address(const void* from, const void* to, outputStream* st) { | |||
|
|||
ResourceMark rm; |
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.
Okay. I was trying to find where the existing callers have their RM and it is not obvious.
Thanks @MBaesken and @dholmes-ora ! /integrate |
Going to push as commit c6f3bf4.
Your commit was automatically rebased without conflicts. |
To investigate footprint problems of processes with a short lifespan (e.g. startup footprint problems), we found it very useful to be able to get an annotated memory map at exit - the same map printed by jcmd System.map.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19660/head:pull/19660
$ git checkout pull/19660
Update a local copy of the PR:
$ git checkout pull/19660
$ git pull https://git.openjdk.org/jdk.git pull/19660/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 19660
View PR using the GUI difftool:
$ git pr show -t 19660
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19660.diff
Webrev
Link to Webrev Comment