|
static class MemoryUsage { |
|
public long usage() { |
|
final long freeMemory = Runtime.getRuntime().freeMemory(); |
|
final long totalMemory = Runtime.getRuntime().totalMemory(); |
|
return totalMemory - freeMemory; |
|
} |
ResourceMonitor get the memory usage by using total memory - free memory. While the whole process of a query(even other queries previous to the current one) will accumulate the memory usage until GC.
Originally posted by @qianheng-aws in #3971 (comment)