RFR: 8281631: HashMap.putAll can cause redundant space waste [v6]

XenoAmess duke at openjdk.java.net
Tue Feb 15 02:16:11 UTC 2022


On Tue, 15 Feb 2022 02:00:35 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> The changes to j.l.Class and the EnumConstantDirectory test don't belong here -- these are _uses_ of HashMap. This bug and fix should focus on HashMap itself, to ensure that the cases in question allocate a table of the right size.

A test will fail if not change codes there.

> Are there any other maps that have this computation besides HashMap and WeakHashMap?

good question. Can I get a list of classes where I should check?(I guesd I shall start at linkerhashmap and sets, but have no further ideas)

> There should be a regression test for this. It's probably sufficient to base this on your original test program, which puts 12 entries into a HashMap using a variety of techniques. It should assert that the table size is 16 in all cases. Also, should there be a test case for WeakHashMap?

OK I will havr a try...

> Also, I changed the summary of the bug report to be more precise. The PR title will need to be changed to correspond to it. Thanks.

OK.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7431


More information about the core-libs-dev mailing list