Repository navigation
fix: cap byte[] allocations at MAX_ARRAY_LENGTH (Integer.MAX_VALUE - 8) - #163
Merged
Merged
Conversation
HotSpot rejects byte[] of Integer.MAX_VALUE and Integer.MAX_VALUE - 1
("Requested array size exceeds VM limit") on any heap size. With more
than 2 GB buffered, trim() allocated exactly such an array.
- MAX_ARRAY_LENGTH mirrors jdk.internal.util.ArraysSupport
.SOFT_MAX_ARRAY_LENGTH (JDK-internal, absent on Java 8).
- maxAllocationSize defaults to it; setMaxAllocationSize clamps above it.
- Tests: constant value, default, clamp boundaries.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018mLGtytvtJU7aNshBpnrB5
…OpenJML#982 - Invariant RAC crash ("no enclosing instance") not minimally reproducible; invariants stay omitted defensively. - Atomic*.jml RAC IllegalAccessError reported upstream; the rm in setup-openjml stays until an OpenJML release ships the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018mLGtytvtJU7aNshBpnrB5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018mLGtytvtJU7aNshBpnrB5
bernardladenthin
had a problem deploying
to
startgate
September 30, 2026 21:26 — with
GitHub Actions
Error
bernardladenthin
had a problem deploying
to
maven-central
September 30, 2026 21:26 — with
GitHub Actions
Failure
bernardladenthin
had a problem deploying
to
maven-central
September 30, 2026 21:26 — with
GitHub Actions
Failure
6 of 7 tasks
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
trim()allocatednew byte[Integer.MAX_VALUE]. HotSpot always rejectsInteger.MAX_VALUEandInteger.MAX_VALUE - 1("Requested array size exceeds VM limit"), regardless of heap size (verified on JDK 21).MAX_ARRAY_LENGTH = Integer.MAX_VALUE - 8, the same value asjdk.internal.util.ArraysSupport.SOFT_MAX_ARRAY_LENGTH. It is mirrored because that class is JDK-internal and absent on Java 8.maxAllocationSizedefaults to it, andsetMaxAllocationSizeclamps larger values to it.getMaxAllocationSize()now defaults toInteger.MAX_VALUE - 8.Atomic*.jmlRACIllegalAccessError. Thermworkaround insetup-openjmlstays until an OpenJML release ships the fix.Test plan
mvn test, 9 new test cases: constant value, default, clamp boundaries atMAX_ARRAY_LENGTH± 1,Integer.MAX_VALUE - 1,Integer.MAX_VALUE,Long.MAX_VALUE)failOnWarnings,doclint all) cleanRelated issues / PRs
Refs OpenJML/Specs#29, OpenJML/OpenJML#982
Checklist
CONTRIBUTING.mdandCODE_OF_CONDUCT.mdSECURITY.md)🤖 Generated with Claude Code
https://claude.ai/code/session_018mLGtytvtJU7aNshBpnrB5