【问题标题】:ActiveMQ - memory not released after consuming all messagesActiveMQ - 消耗所有消息后未释放内存
【发布时间】:2013-08-09 00:52:17
【问题描述】:

我做了一个测试,基于activemq-cpp库的示例解决方案。 在测试中,我将 50,000 条消息发送到一个队列,在它们全部发送后我使用它们,INDIVIDUAL_ACKNOWLEDGE 在会话上,message->acknowledge() 在每条消费消息上。消费者是异步的。

发送消息前 java.exe 的内存(私有工作集):209,320 KB。发送所有消息后:412,548 KB。 消耗所有消息后:434,637 KB。意思是,虽然队列大小为 0,但内存没有被释放。 我错过了什么? 谢谢。

【问题讨论】:

  • 来自stackoverflow.com/questions/16649601/… : JVM acquires memory when it needs to execute some complex logic. When java is done processing the tasks the JVM will still keep that memory as a reserved space and is not released back to the OS. This architecture helps in performance because JMV does not have to request the same memory again from the underlying OS. It will still be within the range you define in -Xmx JVM parameter. - 即,这种行为是正常的。
  • 这是有道理的。谢谢。

标签: activemq activemq-cpp


【解决方案1】:

除了上面提到的 JVM 处理之外,这里还有许多其他因素在起作用。根据您启动生产者发送消息时代理的状态,可能会在代理上分配许多资源以创建队列和各种其他管理对象,然后这些对象将保留在内存中以促进消息路由等。真正分析内存使用情况并检查是否存在泄漏,您应该使用 Yourkit 等工具。

【讨论】:

    猜你喜欢
    • 2015-04-04
    • 1970-01-01
    • 2014-05-10
    • 2013-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-11
    • 2014-11-17
    相关资源
    最近更新 更多