Reputation: 1510
Netty 4 can use direct memory. I think I should/must set option -XX:MaxDirectMemorySize
when starting Java process that uses Netty.
Upvotes: 1
Views: 6182
Reputation: 372
I think that in most cases you won't need to set the direct memory size. If you get to a point were you run out of direct memory, you should first see if you are using the direct memory correctly before setting it manually. Check that you are not creating to many io workers and by that Creating to many direct buffers instead reusing io workers.
Upvotes: 1
Reputation: 12351
It really depends on how much direct memory your application is going to use. By default, the maximum available size of direct memory of JVM is same with the maximum heap size, although it differs between JVM vendors and versions.
io.netty.util.internal.PlatformDependent.maxDirectMemory()
returns the maximum direct memory size in bytes, so you might want to use it for debugging purposes. Actually, Netty logs that value if you set the log level of io.netty.util.internal.PlatformDependent
to DEBUG.
Upvotes: 3
Reputation: 23567
You don't need too.. But it will give the JVM a hint how much direct memory is allowed to be allocated.
Upvotes: 1