`
sswh
  • 浏览: 161548 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

奇怪的AppCrash问题

 
阅读更多

最近发现项目会出现AppCrash问题。

 

经过同事提供的AppCrash的线索(和日志相关),经过定位、剥离无关影响因素,

最后得到最基本的代码如下:

 

public static void main(String[] args) throws Exception {
	byte[] bs = new byte[63000];
	for (int i = 0; i < bs.length; i++) {
		bs[i] = (byte) i;
	}
	System.out.write(("写入" + bs.length + "字节 ----------------").getBytes());
	System.out.write(bs);
	//System.out.print(new String(bs));
	System.out.write(("写入" + bs.length + "字节完成 ----------------").getBytes());
	int n = System.in.read();
	System.out.println(n);
}

 这一段代码在Win7 64位环境 + JRE1.6_0_43 64位版下面会导致AppCrash;(第一次可能不出现,第二次运行就会出现AppCrash)

 更换JRE8以后,Crash问题仍然存在。

 更换到Win2008 64位环境,Crash问题仍然存在。

 但是在Windows 8 下面,这段代码是正常执行的。

 

 真是奇怪了,是我的环境有问题吗?

 BTW, 为什么有上面的测试代码,因为logback在写控制台日志的时候,是使用outputStream.write()方法的。详见:ch.qos.logback.core.encoder.LayoutWrappingEncoder

 

0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics