Console output stored in char [] raises an OutOfMemoryError

I have an applet that doesn't run out of memory. Analysis of the heap dump reveals that the culprit is the char [] owned by traceMsgQueueThread, which contains all the contents of the java output file. This increases over time, as log messages are sent to the console until the applet runs out of memory.

This seems, apparently, for several clients and is observed on different JREs from pre 1.5 to 1.6.0_10. All our clients work with the same parameters, i.e. -Xmx256m and -XX: + HeapDumpOnOutOfMemoryError, but only some of them exhibit this problem.

Disabling the console turned off, it seemed to work in one instance, but it did not repeat and, unfortunately, was not possible, since we need to keep a log.

Has anyone seen this before or knew what to do with it?

+3
source share
2 answers

On Windows, you can disable the console by going to Control Panel-> Java-> Advanced-> Java Console. This, obviously, should be done in stages, but it may not even help, but I suspect that talking about not starting the console will not allow this thread to be created.

+1
source

I need to disable this trace. Try virtual machine configuration or some parameter passed in java call.

0
source

Source: https://habr.com/ru/post/1713218/


All Articles