I have an application which continuously receives data on a socket, and then logs this data to a file while also displaying this data in a JTextPane. Naturally, as data is written to the underlying document of the JTextPane the memory usage continues to increase.
Is there a simple way of limiting the memory which the JTextPane is allowed use? I would like the JTextPane to work similar to how a typical command shell's command history works.