#3828: Set allocator using Netty system property to apply pooled allocator default globally
This commit is contained in:
parent
2bafb70581
commit
ae2fc30b7b
@ -262,6 +262,14 @@ public class BungeeCord extends ProxyServer
|
|||||||
ResourceLeakDetector.setLevel( ResourceLeakDetector.Level.DISABLED ); // Eats performance
|
ResourceLeakDetector.setLevel( ResourceLeakDetector.Level.DISABLED ); // Eats performance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/netty/netty/wiki/Netty-4.2-Migration-Guide
|
||||||
|
// The adaptive allocator, the new default allocator since Netty 4.2, has some memory issues.
|
||||||
|
// Setting it globally also ensures that any plugins would also use the pooled allocator.
|
||||||
|
if ( System.getProperty( "io.netty.allocator.type" ) == null )
|
||||||
|
{
|
||||||
|
System.setProperty( "io.netty.allocator.type", "pooled" );
|
||||||
|
}
|
||||||
|
|
||||||
eventLoops = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() );
|
eventLoops = PipelineUtils.newEventLoopGroup( 0, new ThreadFactoryBuilder().setNameFormat( "Netty IO Thread #%1$d" ).build() );
|
||||||
|
|
||||||
File moduleDirectory = new File( "modules" );
|
File moduleDirectory = new File( "modules" );
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.md_5.bungee.netty;
|
package net.md_5.bungee.netty;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import io.netty.buffer.PooledByteBufAllocator;
|
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelException;
|
import io.netty.channel.ChannelException;
|
||||||
import io.netty.channel.ChannelOption;
|
import io.netty.channel.ChannelOption;
|
||||||
@ -219,9 +218,6 @@ public class PipelineUtils
|
|||||||
{
|
{
|
||||||
// IP_TOS is not supported (Windows XP / Windows Server 2003)
|
// IP_TOS is not supported (Windows XP / Windows Server 2003)
|
||||||
}
|
}
|
||||||
// https://github.com/netty/netty/wiki/Netty-4.2-Migration-Guide
|
|
||||||
// TODO: check for AdaptiveByteBufAllocator
|
|
||||||
ch.config().setAllocator( PooledByteBufAllocator.DEFAULT );
|
|
||||||
ch.config().setWriteBufferWaterMark( MARK );
|
ch.config().setWriteBufferWaterMark( MARK );
|
||||||
|
|
||||||
ch.pipeline().addLast( FRAME_DECODER, new Varint21FrameDecoder() );
|
ch.pipeline().addLast( FRAME_DECODER, new Varint21FrameDecoder() );
|
||||||
|
Loading…
Reference in New Issue
Block a user