请教各位大佬
int[] ints=new int[Integer.MAX_VALUE];
为什么会抛出OutOfMemoryError
栈内存里不是只存一个地址吗
感谢!!!
请教各位大佬
int[] ints=new int[Integer.MAX_VALUE];
为什么会抛出OutOfMemoryError
栈内存里不是只存一个地址吗
感谢!!!
new int[Integer.MAX_VALUE];
这要开一个21亿长度的数组,每个int 4个字节,一共8GB,内存爆了。