Skip to content

Commit

Permalink
GH-2799 avoid OOM through HashMap resizing by setting initial size
Browse files Browse the repository at this point in the history
  • Loading branch information
abrokenjester authored and hmottestad committed Apr 16, 2021
1 parent 0be879b commit 2432726
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ abstract class MemoryOverflowModel extends AbstractModel {
private long maxBlockSize = 0;

public MemoryOverflowModel() {
memory = new LinkedHashModel();
memory = new LinkedHashModel(LARGE_BLOCK);
}

public MemoryOverflowModel(Model model) {
Expand All @@ -76,7 +76,7 @@ public MemoryOverflowModel(Set<Namespace> namespaces, Collection<? extends State
}

public MemoryOverflowModel(Set<Namespace> namespaces) {
memory = new LinkedHashModel(namespaces);
memory = new LinkedHashModel(namespaces, LARGE_BLOCK);
}

@Override
Expand Down Expand Up @@ -282,7 +282,7 @@ protected void finalize() throws Throwable {
}
};
disk.addAll(memory);
memory = new LinkedHashModel(memory.getNamespaces());
memory = new LinkedHashModel(memory.getNamespaces(), LARGE_BLOCK);
logger.debug("overflow synced to disk");
} catch (IOException | SailException e) {
String path = dataDir != null ? dataDir.getAbsolutePath() : "(unknown)";
Expand Down

0 comments on commit 2432726

Please sign in to comment.