Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java can system out result in out of memory issues

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 ?

like image 438
MAG Avatar asked Dec 29 '25 16:12

MAG


1 Answers

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.

like image 110
Peter Lawrey Avatar answered Jan 01 '26 05:01

Peter Lawrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!