gurpartap3697 commented on code in PR #1825:
URL: https://github.com/apache/activemq/pull/1825#discussion_r2989384680


##########
activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4930Test.java:
##########
@@ -110,17 +110,15 @@ public void doTestBrowsePending(int deliveryMode) throws 
Exception {
         LOG.info("Browsed: " + browsed.length);
         assertEquals("maxBrowsePageSize", maxBrowsePageSize, browsed.length);
         Runtime.getRuntime().gc();
-        long free = Runtime.getRuntime().freeMemory()/1024;
-        LOG.info("free at start of check: " + free);
+        long memoryUsageAtStart = underTest.getMemoryUsage().getUsage();
+        LOG.info("Memory usage at start of check: " + memoryUsageAtStart);
         // check for memory growth
         for (int i=0; i<10; i++) {
             LOG.info("free: " + Runtime.getRuntime().freeMemory()/1024);
             browsed = underTest.browse();
             LOG.info("Browsed: " + browsed.length);
             assertEquals("maxBrowsePageSize", maxBrowsePageSize, 
browsed.length);
-            Runtime.getRuntime().gc();
-            Runtime.getRuntime().gc();
-            assertTrue("No growth: " + Runtime.getRuntime().freeMemory()/1024 
+ " >= " + (free - (free * 0.2)), Runtime.getRuntime().freeMemory()/1024 >= 
(free - (free * 0.2)));
+            assertTrue("Memory usage is ballooning: " + 
underTest.getMemoryUsage().getUsage() + " > " + memoryUsageAtStart, 
underTest.getMemoryUsage().getUsage() <= memoryUsageAtStart);

Review Comment:
   Agree, will update



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to