Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚添加了一个异常处理程序来处理一些图像处理时的 OutOfMemoryError,因为有一些关于它发生的崩溃报告。我可以以某种方式填满设备上的内存来测试吗?如果没有,我还要如何测试我是否正确处理了这个问题?
我认为您可以设置对函数的递归调用。这可能会导致StackOverflowException. 不过没试过模拟器。
StackOverflowException
只需开始在 ArrayList 上分配数据:
List<Bitmap> data = new ArrayList<Bitmap>(); while(true){ Bitmap b = Bitmap.createBitmap(1000,1000,Bitmap.Config.ARGB_8888); data.add(b); }