Getting Out of memory error when initializing couchbase client while running testcases .
Environment
JDK 16
OS - macOS Monterey
gradle-version : 7.2
-Xmx8000m
-Xms2000m
-XX:MaxDirectMemorySize=1024m
-XX:+UseG1GC
Please find the stacktrace below .
Caused by: java.lang.OutOfMemoryError: Cannot reserve 131072 bytes of direct buffer memory (allocated: 536760640, limit: 536870912)
at java.base/java.nio.Bits.reserveMemory(Bits.java:178)
at java.base/java.nio.DirectByteBuffer.(DirectByteBuffer.java:121)
at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:330)
at com.couchbase.client.core.deps.io.netty.channel.unix.Buffer.allocateDirectWithNativeOrder(Buffer.java:40)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventArray.(KQueueEventArray.java:52)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoop.(KQueueEventLoop.java:88)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:185)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.newChild(KQueueEventLoopGroup.java:33)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:84)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:60)
at com.couchbase.client.core.deps.io.netty.util.concurrent.MultithreadEventExecutorGroup.(MultithreadEventExecutorGroup.java:49)
at com.couchbase.client.core.deps.io.netty.channel.MultithreadEventLoopGroup.(MultithreadEventLoopGroup.java:59)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.(KQueueEventLoopGroup.java:111)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.(KQueueEventLoopGroup.java:98)
at com.couchbase.client.core.deps.io.netty.channel.kqueue.KQueueEventLoopGroup.(KQueueEventLoopGroup.java:74)
at com.couchbase.client.core.env.IoEnvironment.createEventLoopGroup(IoEnvironment.java:510)
at com.couchbase.client.core.env.IoEnvironment.(IoEnvironment.java:303)
at com.couchbase.client.core.env.IoEnvironment.(IoEnvironment.java:66)
at com.couchbase.client.core.env.IoEnvironment$Builder.build(IoEnvironment.java:726)
at com.couchbase.client.core.env.CoreEnvironment.(CoreEnvironment.java:153)
at com.couchbase.client.java.env.ClusterEnvironment.(ClusterEnvironment.java:53)
at com.couchbase.client.java.env.ClusterEnvironment.(ClusterEnvironment.java:46)
at com.couchbase.client.java.env.ClusterEnvironment$Builder.build(ClusterEnvironment.java:213)