EdColeman commented on code in PR #3508:
URL: https://github.com/apache/accumulo/pull/3508#discussion_r1235821860
##########
server/base/src/main/java/org/apache/accumulo/server/mem/LowMemoryDetector.java:
##########
@@ -105,68 +101,50 @@ public void logGCInfo(AccumuloConfiguration conf) {
try {
final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime());
- List<GarbageCollectorMXBean> gcmBeans =
ManagementFactory.getGarbageCollectorMXBeans();
Runtime rt = Runtime.getRuntime();
StringBuilder sb = new StringBuilder("gc");
boolean sawChange = false;
- long maxIncreaseInCollectionTime = 0;
-
- for (GarbageCollectorMXBean gcBean : gcmBeans) {
- Long prevTime = prevGcTime.get(gcBean.getName());
- long pt = 0;
- if (prevTime != null) {
- pt = prevTime;
- }
-
- long time = gcBean.getCollectionTime();
-
- if (time - pt != 0) {
- sawChange = true;
+ final long maxConfiguredMemory = rt.maxMemory();
+ final long allocatedMemory = rt.totalMemory();
+ final long allocatedFreeMemory = rt.freeMemory();
+ final long freeMemory = maxConfiguredMemory - (allocatedMemory -
allocatedFreeMemory);
+ final double lowMemoryThreshold = maxConfiguredMemory *
freeMemoryPercentage;
+ log.trace("Memory info: max={}, allocated={}, free={}, free
threshold={}",
+ maxConfiguredMemory, allocatedMemory, freeMemory, (long)
lowMemoryThreshold);
+
+ if (freeMemory < (long) lowMemoryThreshold) {
+ lowMemCount++;
+ if (lowMemCount > 3 && !runningLowOnMemory) {
+ runningLowOnMemory = true;
+ log.info("Running low on memory: max={}, allocated={}, free={}, free
threshold={}",
Review Comment:
Fixed in e58cfec34c
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]