-
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
8261154: Memory leak in Java_java_lang_ClassLoader_defineClass0 with long class names #2407
Conversation
👋 Welcome back redestad! A progress list of the required criteria for merging this PR into |
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.
Hi Cleas,
looks good but why changing the the NULL comparisons?
If you wanted to simplify you could completely omit the NULL checks since free(NULL) is a noop. And potentially merge the labels - where there are two - into one.
Cheers, Thomas
I'm not sure every platform have always agreed free(NULL) is a noop. I suspect all the currently supported ones do, though? |
Its standard behavior. Posix: https://pubs.opengroup.org/onlinepubs/009695399/functions/free.html "If ptr is a null pointer, no action shall occur. " So it should be okay. |
Right. I dialed back the changes here since this is a bug fix that should be kept minimal. I have another change in the pipeline that will touch code here that can double down on cleaning up. |
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.
LGTM.
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!
@cl4es 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 55 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 |
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 for fixing this.
@tstuefe, @ChrisHegarty, @mlchung - thanks for reviewing! /integrate |
@cl4es Since your change was applied there have been 65 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 0791899. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This patch resolves a potential memory leak in Java_java_lang_ClassLoader_defineClass0
I've not figured a good way to write a regression test. A crude way to manually verify the leak and the fix is provided by the added microbenchmark that triggers the malloc in ClassLoader.c and the associated leak.
E.g., running this with
/usr/bin/time -v $BUILD_DIR/images/jdk/bin/java -Xmx256m -jar $BUILD_DIR/images/test/micro/benchmarks.jar LookupDef.*WeakClass.loadLong -f 0 -i N | grep "Maximum resident set"
yields:Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2407/head:pull/2407
$ git checkout pull/2407