assertFalse("Cache disabled on q", queueViewMBean.isCacheEnabled());
// ensure repeated browse does now blow mem
final Queue underTest = (Queue) ((RegionBroker)broker.getRegionBroker()).getQueueRegion().getDestinationMap().get(bigQueue);
// do twice to attempt to pull in 2*maxBrowsePageSize which uses up the system memory limit
Message[] browsed = underTest.browse();
LOG.info("Browsed: " + browsed.length);
assertEquals("maxBrowsePageSize", maxBrowsePageSize, browsed.length);
browsed = underTest.browse();
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);
// 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)));