Skip to content

Cap deserialized LocalCache+MapMakerInternalMap concurrency level at 1024. - #8714

Merged
copybara-service[bot] merged 1 commit into
masterfrom
test_993648446
Oct 5, 2026
Merged

copybara-service[bot] merged 1 commit into
masterfrom
test_993648446

Conversation

@copybara-service

Copy link
Copy Markdown
Contributor

Cap deserialized LocalCache+MapMakerInternalMap concurrency level at 1024.

1024 ought to be enough for anybody. And probably few people are serializing caches or weak-entry-based maps, anyway. And people should be using Caffeine.

There was already a cap of 64k, so these collections didn't permit arbitrary-sized allocations. Still, the reduction brings them more in line with what is already possible when deserializing built-in JDK types. See, for example, LogRecord and ZoneRules (though the constant factors are still different).

(If any user of the classes is directly passing a concurrency level of more than 1024, it's extremely likely that that user would be better off if we were to cap it to 1024 in that code path, too. But I'm not bothering in this CL.)

RELNOTES=n/a

… at 1024.

1024 ought to be enough for anybody. And probably few people are serializing caches or weak-entry-based maps, anyway. And people should be using [Caffeine](https://github.com/ben-manes/caffeine).

There was already a cap of 64k, so these collections didn't permit arbitrary-sized allocations. Still, the reduction brings them more in line with what is already possible when deserializing built-in JDK types. See, for example, [`LogRecord`](https://github.com/openjdk/jdk/blob/4e8bec6f862b58732537dea15cb3dd50a01fede0/src/java.logging/share/classes/java/util/logging/LogRecord.java#L704) and [`ZoneRules`](https://github.com/openjdk/jdk/blob/4e8bec6f862b58732537dea15cb3dd50a01fede0/src/java.base/share/classes/java/time/zone/ZoneRules.java#L464) (though the constant factors are still different).

(If any user of the classes is directly passing a concurrency level of more than 1024, it's extremely likely that that user would be better off if we were to cap it to 1024 in that code path, too. But I'm not bothering in this CL.)

RELNOTES=n/a
PiperOrigin-RevId: 993749847
@copybara-service
copybara-service Bot merged commit 81c7d03 into master Oct 5, 2026
15 checks passed
@copybara-service
copybara-service Bot deleted the test_993648446 branch October 5, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant