java permgen space_PermGen space内存溢出解决办法

服务启动后一段时间内,突然内存溢出:Exception in thread “main” java.lang.OutOfMemoryError: PermGen space

第一想的就是jar依赖是不是互相依赖导致的,后来发现并不是

很快找到触发内存不够的那段代码,注释掉

public void receivePrintResult() throws Exception {

Properties properties = new Properties();

properties.setProperty(ConsumerConstants.MafkaBGNamespace, "daocan");

properties.setProperty(ConsumerConstants.MafkaClientAppkey, "orderdish-platform-print-service");

properties.setProperty(ConsumerConstants.SubscribeGroup, "orderdish-platform-print-service");

consumer = MafkaClient.buildConsumerFactory(properties, "owl_print_result_notify");

/* consumer.recvMessageWithParallel(String.class, new IMessageListener() {

@Override

public ConsumeStatus recvMessage(MafkaMessage mafkaMessage, MessagetContext messagetContext) {

try {

String result = (String) mafkaMessage.getBody();

System.out.print(result);

INFO_LOG.info("resultResponse success:{}"+ result);

printResultRedisService.analysePrintResult(result);//处理消息队列

}catch (Exception e){

ERROR_LOG.error("mafka reseivePrintResult#fail Exception:{}",e);

return ConsumeStatus.RECONSUME_LATER;

}

System.out.println("=======================================");

return ConsumeStatus.CONSUME_SUCCESS;

}

});*/

}

采用jvisualvm.exe工具查看内存堆使用情况:

2148644ce119b61660f09d68d7b12955.png

可以看出内存几乎使用完成,导致内存溢出

配置 :  -server -XX:PermSize=128M -XX:MaxPermSize=256m

c3742075bc7903c46b6f33f9329df099.png

手动扩大内存解决问题

3f950173717853d5a61aa453c0f8f0c0.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值