Skip to content

Commit 327b6d9

Browse files
committed
Prevent overallocating space for message recipients
1 parent 6500168 commit 327b6d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/projections/Tools/Timeline/TimelineMessage.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,10 @@ protected EntryMethodObject getSender() {
126126

127127
protected void addRecipient(EntryMethodObject obj) {
128128
synchronized (this) {
129-
if (recipients == null)
130-
recipients = new ArrayList<>();
129+
if (recipients == null) {
130+
// Set initialCapacity to 1 to prevent recipients from allocating more memory than needed
131+
recipients = new ArrayList<>(1);
132+
}
131133
recipients.add(obj);
132134
}
133135
}

0 commit comments

Comments
 (0)