/** * @return the current amount of direct memory used by netty module. */ public static long getNettyDirectMemoryUsage() { ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider) PooledByteBufAllocator.DEFAULT).metric(); return metric.usedDirectMemory(); }