From 78c4abbfb7afe68d420a50be168ed6467f08162f Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Mon, 1 Apr 2019 19:43:19 +0200 Subject: [PATCH] Change default of io.netty.allocator.useCacheForAllThreads to false (#8991) Motivation: We currently use a thread local cache for all threads which often is suprising to users as it may result in a lot of memory usage if they allocate buffers from outside the EventLoop in different threads. We should better not do this by default to keep suprises to a minimum. Users that need the performance and know what they are doing can still change this. Modifications: Change io.netty.allocator.useCacheForAllThreads to false by default Result: Related to https://github.com/netty/netty/issues/8536. --- .../src/main/java/io/netty/buffer/PooledByteBufAllocator.java | 2 +- .../test/java/io/netty/buffer/PooledByteBufAllocatorTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java b/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java index 8865c15c9d..9b72954b41 100644 --- a/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java +++ b/buffer/src/main/java/io/netty/buffer/PooledByteBufAllocator.java @@ -123,7 +123,7 @@ public class PooledByteBufAllocator extends AbstractByteBufAllocator implements "io.netty.allocation.cacheTrimIntervalMillis", 0); DEFAULT_USE_CACHE_FOR_ALL_THREADS = SystemPropertyUtil.getBoolean( - "io.netty.allocator.useCacheForAllThreads", true); + "io.netty.allocator.useCacheForAllThreads", false); DEFAULT_DIRECT_MEMORY_CACHE_ALIGNMENT = SystemPropertyUtil.getInt( "io.netty.allocator.directMemoryCacheAlignment", 0); diff --git a/buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java b/buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java index 06059271f7..86cedd12b0 100644 --- a/buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java +++ b/buffer/src/test/java/io/netty/buffer/PooledByteBufAllocatorTest.java @@ -117,7 +117,7 @@ public class PooledByteBufAllocatorTest extends AbstractByteBufAllocatorTest