PermGen space内存溢出解决办法

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

第一想的就是jar依赖是否是互相依赖致使的,后来发现并非ide

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

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工具查看内存堆使用状况:ui

能够看出内存几乎使用完成,致使内存溢出spa

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

手动扩大内存解决问题orm

相关文章
相关标签/搜索