dwmkerr / consolecontrol

ConsoleControl is a C# class library that lets you embed a console in a WinForms or WPF application.
MIT License
723 stars 169 forks source link

Infinite buffer size #46

Open sbayeta opened 4 years ago

sbayeta commented 4 years ago

Hi,

First of all, thanks and congratulations for this excellent work!

I just found your CodeProject article about this control, and it turns out it's exactly what I was looking for (I arrived to it by googling "winforms embed console").

I'd like to use your control to run a console application that will run for a very long time (probably weeks of more if nothing wrong happens). This console application logs a lot of information, so before starting the integration I created a toy app to test your control memory usage.

The console app simply enters an infinite loop writing a line of text in each iteration.

When I run it from inside the ConsoleControl, the memory usage reported by VisualStudio started to increase rapidly (it reached 1GB in around 30 seconds).

Would you consider adding a property to limit the buffer size? I googled "richtextbox buffer size" and found an article that might be usefull for this: https://www.codeproject.com/Articles/34056/Controlling-the-Length-of-a-RichTextBox-in-C

If you're interested in adding this feature but don't have the time to do it, please let me know and I could try to fix it myself and send you a pull request.

I'm using the latest version as of this writing (1.2.1 added to my toy project using Nuget).

image

Best regards, Santiago