Skip to content

Conversation

@som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Mar 21, 2024

Defer array resize on empty; resizeUp no longer resizes at target length zero.

addAll no longer assumes elems is allocated (non-null).

ArrayBuffer allocates eagerly anyway, so it is unaffected by not resizing at "default".

Fixes scala/bug#12971

@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Mar 21, 2024
@som-snytt som-snytt modified the milestones: 2.13.15, 2.13.14 Mar 21, 2024
@SethTisue SethTisue added prio:blocker release blocker (used only by core team, only near release time) library:collections PRs involving changes to the standard collection library labels Mar 21, 2024
@SethTisue SethTisue requested a review from a team March 21, 2024 18:58
Copy link
Member

@OndrejSpanel OndrejSpanel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the more logical order would be to test for

Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@som-snytt som-snytt force-pushed the issue/12971-array-builder branch from 46eda07 to 6671b71 Compare April 4, 2024 17:26
@som-snytt som-snytt merged commit fd3e629 into scala:2.13.x Apr 8, 2024
@som-snytt som-snytt deleted the issue/12971-array-builder branch April 8, 2024 17:18
@SethTisue SethTisue added release-notes worth highlighting in next release notes and removed prio:blocker release blocker (used only by core team, only near release time) labels Apr 8, 2024
@SethTisue SethTisue changed the title Defer array resize on empty Defer array resize on empty (fixing 2.13.13 regression) Apr 19, 2024
@SethTisue SethTisue changed the title Defer array resize on empty (fixing 2.13.13 regression) Fix ArrayBuilder regression in Scala 2.13.13 (OutOfMemoryError when adding empty arrays) Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

library:collections PRs involving changes to the standard collection library release-notes worth highlighting in next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ArrayBuilder regression in scala 2.13.13, OutOfMemoryError when adding empty arrays

6 participants