python – Should I clean my console?

Question:

Let's say logging is going to the console. Lines with print are output.

But doesn't this clutter up the memory if there are a lot of prints and the program is kept active for a long time? Should I clean my console? Or even remove all prints? Or maybe it has no effect?

Answer:

The answer to this question depends on the console window settings ( cmd on Windows, terminal on Linux/MacOS). Usually, the parameter responsible for storing the output buffer is called scroll buffer .

Even if we set the value of this buffer to 10,000 lines and take into account the average line length of 100 characters, it will take: 10000 * 100 / 1024 = 977 KiB – i.e. less than one megabyte.

Therefore, I think that such trifles should not be dealt with.

Scroll to Top