--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java Sun Oct 13 16:46:15 2019 +0200
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/LongMap.java Wed Oct 16 01:16:12 2019 +0200
@@ -157,9 +157,6 @@
// Lazy initialization
initialize(DEFAULT_SIZE);
}
- if (count > 3 * keys.length / 4) {
- expand(2 * keys.length);
- }
if (object == null) {
object = (T) NULL_OBJECT;
}
@@ -171,6 +168,12 @@
keys[index] = id;
objects[index] = object;
count++;
+ // Don't expand lazy since it
+ // can cause resize when replacing
+ // an object.
+ if (count > 3 * keys.length / 4) {
+ expand(2 * keys.length);
+ }
return;
}
// if it already exists, replace