每次请求都是将同样键值对存入HashMap中,请求多了出现卡顿甚至页面奔溃的现象!
查看网上例子,使用clear()方法只能清除值,堆内存依旧被占用,无法解决。
使用Map = null的方式,出现空指针异常!
部分代码如下:
for(int x=0; x<4; x++){
for (int y=0; y<4; y++){
os.paintRegionOfLevel(graphics2D, 0, 0,256*x, 256*y, 256, 256, 0);
graphics2D.dispose();
ImageIO.write(result, "jpg", baos);
byte[] bytes = baos.toByteArray();
hash2.put(y+"_"+x, bytes);
// list.add(hash2);
}
}
hash1.put("code", 0);
hash1.put("msg", "返回成功!");
hash1.put("data",hash2);
return hash1;