java can system out result in out of memory issues

≯℡__Kan透↙ 提交于 2019-12-06 08:32:05

问题


This is a theoretical question .

Can a flood of system out on java applet , cause applet to go out of memory ?

If yes what would be an easy solution to remove multiple sysout spanning across multiple files ?


回答1:


A single System.out.println(x) can cause an out of memory error, if x.toString() uses too much memory.

Can a flood of system out on java applet , cause applet to go out of memory ?

It is size of the resulting String which matters, not the number. More messages will be slower, but make no difference to the amount of free memory after a Full GC and that is what counts.



来源:https://stackoverflow.com/questions/24449996/java-can-system-out-result-in-out-of-memory-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!