From ee4b27491f792765647cf6bbd032b15746cf931d Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Mon, 15 Jul 2024 14:07:18 +0200 Subject: [PATCH] change the default value of retainedHeapMemory and retainedDirectMemory in the Tracking pool to use a retaining variant Signed-off-by: Ludovic Orban --- .../org/eclipse/jetty/io/ArrayByteBufferPool.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayByteBufferPool.java b/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayByteBufferPool.java index cb10103e1646..e34ebe9cad88 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayByteBufferPool.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/ArrayByteBufferPool.java @@ -349,21 +349,27 @@ public static class Tracking extends ArrayByteBufferPool { public Tracking() { + // Do not call super as we want to change the default value of retainedHeapMemory and retainedDirectMemory. + this(-1, -1, -1, -1, 0, 0); } public Tracking(int minCapacity, int factor, int maxCapacity) { - super(minCapacity, factor, maxCapacity); + // Do not call super as we want to change the default value of retainedHeapMemory and retainedDirectMemory. + this(minCapacity, factor, maxCapacity, -1, 0, 0); } public Tracking(int minCapacity, int factor, int maxCapacity, int maxQueueLength) { - super(minCapacity, factor, maxCapacity, maxQueueLength); + // Do not call super as we want to change the default value of retainedHeapMemory and retainedDirectMemory. + this(minCapacity, factor, maxCapacity, maxQueueLength, 0, 0); } public Tracking(int minCapacity, int factor, int maxCapacity, int maxBucketSize, long maxHeapMemory, long maxDirectMemory) { - super(minCapacity, factor, maxCapacity, maxBucketSize, maxHeapMemory, maxDirectMemory); + // Set retainedHeapMemory and retainedDirectMemory to the same values as maxHeapMemory and maxDirectMemory respectively + // to default to a retaining pool. + super(minCapacity, factor, maxCapacity, maxBucketSize, maxHeapMemory, maxDirectMemory, maxHeapMemory, maxDirectMemory); } public Tracking(int minCapacity, int factor, int maxCapacity, int maxBucketSize, long maxHeapMemory, long maxDirectMemory, long retainedHeapMemory, long retainedDirectMemory)