当空间实际可用时,Java堆空间

时间:2018-02-08 11:52:16

标签: java jms activemq heap amq

我试图在AMQ(5.15.2)上发送BytesMessage,但即使内存明显可用,我也会在堆空间异常中运行。这里是

byte[] contcentBuilder = new Byte[1000*1000*1];
Array.fill(contentBuilder, (byte) 1);
BytesMessage message = session.createBytesMessage();
for(int i=0;i<150;i++){
    message.writeBytes(contentBuilder);
}
contentBuilder=null;
producer.send(message); //here it gets the heap space memory error
Runtime.getRunTime().freeMemory(); //this is in debug

在错误中,可用内存超过15Gb(我为此VM分配了16Gb)。

欢迎任何想法,谢谢。

编辑:我基本上是愚蠢的,问题出在AMQ方面,并且增加了它在bin / win64 / wrapper.conf中的内存完成了这项工作。感谢所有回答的人。

新来的我不知道如何结束这个答案!

1 个答案:

答案 0 :(得分:0)

还是我,问题出现在AMQ方面,并且在bin / win64 / wrapper.conf中增加了它的内存。感谢所有回答的人。