From 888d25f7ea10a752fd1d3b8cb6554aaa1f0f7eaf Mon Sep 17 00:00:00 2001 From: ahr Date: Sat, 23 Dec 2017 09:42:08 +0100 Subject: [PATCH] trim docIdToDoc list This reduces memory usage by 1 or 2 MB. 33% of an ArrayList can be free. If the list is 1 million entries long, then the list wastes 2.6 MB. The Doc objects in the list are much bigger. --- .../main/java/org/lucares/pdb/datastore/internal/DataStore.java | 1 + 1 file changed, 1 insertion(+) diff --git a/data-store/src/main/java/org/lucares/pdb/datastore/internal/DataStore.java b/data-store/src/main/java/org/lucares/pdb/datastore/internal/DataStore.java index b0c3fd1..8dfa82f 100644 --- a/data-store/src/main/java/org/lucares/pdb/datastore/internal/DataStore.java +++ b/data-store/src/main/java/org/lucares/pdb/datastore/internal/DataStore.java @@ -70,6 +70,7 @@ public class DataStore { }); trimIntLists(); + ((ArrayList)docIdToDoc).trimToSize(); } private void cacheTagToFileMapping(final Tags tags, final Path path) {