ppm内存溢出问题解决

本文详细记录了一次解决PPM系统内存溢出问题的过程,从JVM参数调优、堆栈分析、Native Heap排查到分布式事务的影响,最终发现是由于使用了特定的Oracle XA数据库驱动导致的问题,通过更换驱动并调整事务处理方式成功解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ppm内存溢出问题解决

一、发现问题

PPM系统手工下发数据到CRM时。下发10万条,每次2000条分页下发。

时间长了会出现内存溢出。在测试库测试发现,linux的内存占用会上升到40%,然后weblogic抛出错误

 

# java.lang.OutOfMemoryError: requested 67 bytes for char in /BUILD_AREA/jdk6_05/hotspot/src/share/vm/runtime/sharedRuntime.cpp. Out of swap space?

另外,在weblogictomcat下面测试,weblogic下面会出现这个问题,tomcat没有问题。另外把这句代码注释后,问题就不会出现了。Weblogictomcat的不同点在于weblogic用了分布式事务,tomcat是开发环境,没有用分布式事务。

 

二、分析问题

1、JVM参数调优

问题一定是和这个查询语句有关。但是这个SQL查询没有问题,dao也是单例的,对象也是方法内定义的,也不是静态的,应该会被回收:

 

看了weblogic的启动配置,于是通过打印GC来看一下问题,一开始发现打印的GC是这种格式:

352.403: [GC 352.404: [DefNew: 13487K->737K(14208K), 0.0121280 secs] 84892K->72466K(203264K), 0.0122890 secs] [Times: user=0.01 sys=0.01, real=0.01 secs] 

DefNew代表的意义是串行回收器,而这个应用是大吞吐量的应用,应该是并行回收才对。所以就改成了并行回收。

关于GC日志:http://blog.youkuaiyun.com/huangzhaoyang2009/article/details/11860757

关于Jvm内存调优jstat的使用:

http://www.cnblogs.com/jackyrong/archive/2010/01/21/1653163.html

新生代与老生代:http://blog.youkuaiyun.com/ustcxjt/article/details/7287430

详细的JVM内存模型、GC收集器:

``` if(temperature_count>send_data) { temperature_count=0; if(zy_mode==1) { //=========================================================================== // 加密数据 ZY5 //=========================================================================== temp=RX_PPM+255; for(ww=0;ww<14;ww++) { C_ppm[ww]=temp&0x01; temp>>=1; } temp=(rand()%3)+1; C_ppm[14]=temp&0x01; temp>>=1; C_ppm[15]=temp&0x01; temp=(C_ppm[14]<<=7)|(C_ppm[3]<<=6)|(C_ppm[7]<<=5)|(C_ppm[10]<<=4)|(C_ppm[11]<<=3)|(C_ppm[5]<<=2)|( C_ppm[9]<<=1)|(C_ppm[12]); temp<<=8; temp+=((C_ppm[4]<<=7)|(C_ppm[6]<<=6)|(C_ppm[1]<<=5)|( C_ppm[8]<<=4)|(C_ppm[13]<<=3)|(C_ppm[2]<<=2)|(C_ppm[15]<<=1)|(C_ppm[0])); cat_ppm=temp; //=========================================================================== //=========================================================================== Modbus_tx_buf[0] = 0xaa; Modbus_tx_buf[1] = 0xbb; Modbus_tx_buf[2] = 2; Modbus_tx_buf[3] = cat_ppm>>8; Modbus_tx_buf[4] = cat_ppm&0xff; CRC16_CAT1_TX_4321(Modbus_tx_buf,5); Modbus_tx_buf[5]=catzy3_crc1; Modbus_tx_buf[6]=catzy3_crc2; Modbus_tx_buf[7]=catzy3_crc3; Modbus_tx_buf[8]=catzy3_crc4; //.......................................................... tx_cat_buf[0]=cat_add1[0]; tx_cat_buf[1]=cat_add1[1]; tx_cat_buf[2]=cat_add1[2]; tx_cat_buf[3]=cat_add1[3]; tx_cat_buf[4]=Modbus_tx_buf[0]; tx_cat_buf[5]=Modbus_tx_buf[1]; tx_cat_buf[6]=Modbus_tx_buf[2]; tx_cat_buf[7]=Modbus_tx_buf[3]; tx_cat_buf[8]=Modbus_tx_buf[4]; tx_cat_buf[9]=Modbus_tx_buf[5]; tx_cat_buf[10]=Modbus_tx_buf[6]; tx_cat_buf[11]=Modbus_tx_buf[7]; tx_cat_buf[12]=Modbus_tx_buf[8]; uart1_rx_count=0; //.......................................................... HAL_UART_Transmit(&huart1, tx_cat_buf,13,60000); //.......................................................... } else { cat_ppm=RX_PPM; Modbus_tx_buf[0] = 1; Modbus_tx_buf[1] = 3; Modbus_tx_buf[2] = 2; Modbus_tx_buf[3] = cat_ppm>>8; Modbus_tx_buf[4] = cat_ppm&0xff; temp=CRC16_creat(Modbus_tx_buf,5); Modbus_tx_buf[5]=temp&0XFF; Modbus_tx_buf[6]=temp>>8; tx_cat_buf[0]=cat_add1[0]; tx_cat_buf[1]=cat_add1[1]; tx_cat_buf[2]=cat_add1[2]; tx_cat_buf[3]=cat_add1[3]; tx_cat_buf[4]=Modbus_tx_buf[0]; tx_cat_buf[5]=Modbus_tx_buf[1]; tx_cat_buf[6]=Modbus_tx_buf[2]; tx_cat_buf[7]=Modbus_tx_buf[3]; tx_cat_buf[8]=Modbus_tx_buf[4]; tx_cat_buf[9]=Modbus_tx_buf[5]; tx_cat_buf[10]=Modbus_tx_buf[6]; uart1_rx_count=0; //.......................................................... HAL_UART_Transmit(&huart1, tx_cat_buf,11,60000); //.......................................................... } }```memcpy报错
03-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值