当我尝试使用Redisson连接Redis Server时,有时会向我显示内存泄漏错误。我该如何解决。 复制代码在下面。
它不应该发生内存泄漏。
[main] ERROR io.netty.util.ResourceLeakDetector - LEAK: HashedWheelTimer.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information.
Recent access records:
Created at:
io.netty.util.HashedWheelTimer.<init>(HashedWheelTimer.java:272)
io.netty.util.HashedWheelTimer.<init>(HashedWheelTimer.java:216)
io.netty.util.HashedWheelTimer.<init>(HashedWheelTimer.java:195)
org.redisson.connection.MasterSlaveConnectionManager.initTimer(MasterSlaveConnectionManager.java:318)
org.redisson.connection.MasterSlaveConnectionManager.<init>(MasterSlaveConnectionManager.java:161)
org.redisson.connection.SingleConnectionManager.<init>(SingleConnectionManager.java:34)
org.redisson.config.ConfigSupport.createConnectionManager(ConfigSupport.java:192)
org.redisson.Redisson.<init>(Redisson.java:122)
org.redisson.Redisson.create(Redisson.java:159)
test.main(test.java:32)
Codec stringCodec = new StringCodec();
for (int i = 0; i < 10; i++) {
RedissonClient client;
Config config = new Config();
config.useSingleServer().setAddress(RedisConfig.Address);
config.useSingleServer().setPassword(RedisConfig.Password);
config.setCodec(stringCodec);
client = Redisson.create(config);
BatchOptions options = BatchOptions.defaults();
RBatch pipe = client.createBatch(options);
pipe.getBucket("test", stringCodec).getAsync();
BatchResult res = pipe.execute();
System.out.println(res.getResponses().get(0));
client.shutdown();
System.gc();
}
4.0.10
3.7.5
Config config = new Config();
config.useSingleServer().setAddress(RedisConfig.Address);
config.useSingleServer().setPassword(RedisConfig.Password);
config.setCodec(stringCodec);
client = Redisson.create(config);
答案 0 :(得分:0)
这看起来像是Redisson中的错误,它会创建很多HashedWheelTimer
而没有关闭它们。我会在那里打开一个错误报告。