I have a text area which i populate dynamically(*to be specific I have a QPlainTextEdit in Qt*, but its not important for algorithm suggestion).

Now problem is sometimes Large amounts of data comes and as more data comes in my application becomes heavy,since all the text data is in main memory.

So I thought of the following. We can use a file for storing all the text data and display only limited amount of data dynamically, but at the same time I have to illusion the user that the data size is that of the file, by creating scroll events that trigger when new lines comes.

Is there any standard algorithm for such problem?