I have set <memoryUsage percentOfJvmHeap="50" /> and it still used up all heap memory and the server can do nothing but gc. I have set max heap size -Xmx1g all the messages I sent are TextMessages. I suspect that there exists bug in estimating memory usage. jmap -histo result is:
1: 3523161 387547952 [C 2: 71065 188665344 [B 3: 3503616 84086784 java.lang.String 4: 1274313 40778016 javax.management.MBeanAttributeInfo 5: 719771 28790840 javax.management.MBeanOperationInfo 6: 770490 24655680 javax.management.MBeanParameterInfo 7: 693101 22179232 java.util.HashMap$Entry 8: 308652 17284512 org.apache.activemq.management.CountStatisticImpl 9: 102903 16842728 [Ljava.util.HashMap$Entry; 10: 354833 15635872 [Ljava.lang.Object; 11: 479668 12333960 [Ljavax.management.MBeanParameterInfo; 12: 311382 9964224 java.util.concurrent.locks.ReentrantLock$NonfairSync 13: 57018 8577136 <constMethodKlass> 14: 171709 8242032 java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync 15: 326334 7832016 java.util.concurrent.atomic.AtomicLong 16: 41969 7722296 org.apache.activemq.command.ActiveMQTextMessage 17: 154461 7414128 java.util.HashMap 18: 131592 7369152 org.apache.activemq.command.MessageId 19: 57018 7308112 <methodKlass> 20: 5244 6225528 <constantPoolKlass> I also dumped all the heap, it's about 1GB.
