GC overhead limit exceeded

lastBatch= fileTotal;
arrayCount=1;
List<Map<String, String>>[] list = new List[arrayCount];
for (int i = 0; i < arrayCount; i++) {
    list[i] = new ArrayList<>();
}
in = new LineNumberReader(new InputStreamReader(new FileInputStream(file), "GBK"));
String line = null;
int lineNumber = 0;
int batchInsert = 0;
for (int m = 0; m < arrayCount; m++){
    List<Map<String, String>> singlelist = list[m];
    int countMax
    int countMin = (singleBatch * m);
    if (m == (arrayCount - 1)){
        countMax = countMin + lastBatch
    }
    while (((line = in.readLine()) != null) && ((lineNumber = in.getLineNumber()) > count
    //line转换为map
    Map<String, String> singleMap = switch2Map(line, type);
    singleList.add(singleMap)
    long insertStart = System.currentTimeMillis();
    String sgl = String.format("insert into t_xxx%02d values (?,?,?,
    ?,?,?,?,?...
    if (type.equals(LnnrConstant.AAA)){
        sql = String.format("insert into t_xxx%02d values (?,?,?,?,???,?,????...
    }
...
}

List<Map<String, String>> singlelist = list[m];

在这一行,创建了一个过百的数组,每个数组放1000的元素,但是使用后没有清空,也就一直没有被释放,导致一直占用内存。clear()后代码如下:

...
batchInsert += ints.length;
long insertEnd = System.currentTimeillis();
long singleTime = insertEnd - insertstart;
singleList.clear;
listi[m] = null;
}
if(fileTotal= batchInsert){
logger.error(String.format("文件批量插队结束,入库总数[%s]与文件总数[s]不一致!",batchInsert, file);
else {
logger,info(String,format("文件"+ sym + "批量插入成功,入库总数[%s],文件总数[%s]", batchInsert, fileTotal);
Latch.countDown();
logger.info("latchCount>>>" + latch. getCount())
tempReader.close()
in.ctose();
/*} catch (Exception e){
/*logger,info("文件" + sym + "批量插入结束,耗时: " + timeTotal + "毫秒");*/
loggererror(e.getMessage());
throw new BatchRuntimeException(e);}*/
...

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值