我注意到 Netty 4 Alpha 8 和 Netty 4 Beta 1 之间的内存消耗大幅增加(+70 个月)
在 Win7 上使用 java 7 运行时进行测试。
Netty 4 alpha 8 代码:https://github.com/ccheneau/Holmes/tree/b_netty_4_alpha_8/holmes-core/src/main/java/net/holmes/core/http
Netty 4 beta 1 代码:https://github.com/ccheneau/Holmes/tree/b_netty_4/holmes-core/src/main/java/net/holmes/core/http
我有什么遗漏吗?
最佳答案
事实上,内存增量是由新的池化字节缓冲区分配器分配的内存。
像这样使用 UnpooledByteBufAllocator:
ServerBootstrap sb = ...
sb.childOption(ChannelOption.ALLOCATOR, UnpooledByteBufAllocator.HEAP_BY_DEFAULT);
减少内存消耗,但也可能提高性能。
关于java - Netty 4 beta1内存消耗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15041706/