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

8346239: Improve memory efficiency of JimageDiffGenerator #22835

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jerboaa
Copy link
Contributor

@jerboaa jerboaa commented Dec 19, 2024

Please review this fairly simple change to improve how the JimageDiffGenerator works. The original implementation is pretty naive and read all bytes into memory and then compared them. This improved version only reads bytes on a bound buffer into memory compares those bytes and if equal continues on to reading the next bytes (2k at most) at a time. Previously it was 2*N (where N is the file size of a file in bytes) part of the JDK. Ouch.

There is still the off-chance of reading a full file into memory when the generator detects a change, but this shouldn't happen for large files since the total diff should be around 600K as of today.

This also reverts changes from JDK-8344036 other than the /timeout change to the test, which is preserved as I think this bump is no longer needed.

Testing:

  • GHA
  • jlink tests on a fastdebug build with --with-native-debug-symbols=internal (so as to have a large libjvm.so).
  • Manual reproducer from the bug which fails with OOM before the patch and passes after

Thoughts?


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8346239: Improve memory efficiency of JimageDiffGenerator (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22835/head:pull/22835
$ git checkout pull/22835

Update a local copy of the PR:
$ git checkout pull/22835
$ git pull https://git.openjdk.org/jdk.git pull/22835/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22835

View PR using the GUI difftool:
$ git pr show -t 22835

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22835.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 19, 2024

👋 Welcome back sgehwolf! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 19, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 19, 2024
@openjdk
Copy link

openjdk bot commented Dec 19, 2024

@jerboaa The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@jerboaa
Copy link
Contributor Author

jerboaa commented Dec 19, 2024

@MBaesken @RealFYang Could you please test this PR since you originally ran into JDK-8346239 (this bug) and JDK-8344036. Thanks!

@mlbridge
Copy link

mlbridge bot commented Dec 19, 2024

Webrevs

@RealFYang
Copy link
Member

@MBaesken @RealFYang Could you please test this PR since you originally ran into JDK-8346239 (this bug) and JDK-8344036. Thanks!

Yes, I can confirm that it works on my linux-aarch64 platform. Great! Thanks!

@MBaesken
Copy link
Member

Hi Severin, I added it to our build/test queue.

@jerboaa
Copy link
Contributor Author

jerboaa commented Dec 20, 2024

Yes, I can confirm that it works on my linux-aarch64 platform. Great! Thanks!

Thank you!

@jerboaa
Copy link
Contributor Author

jerboaa commented Dec 20, 2024

Hi Severin, I added it to our build/test queue.

Thanks, Matthias!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs [email protected] rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants