Help with this (C# Code)

  • Thread starter Thread starter XabiPlayerPRO
  • Start date Start date
  • Views Views 880
  • Replies Replies 2
X

XabiPlayerPRO

Guest
I´m trying to put the text of very very big files (almost 3GB) on a richtextbox, and it lasts too much, and gets frozen. Anything to make it more faster?
 
It takes almost a minute with a 500kb file, so just with a 3gb file will be 6000 more times (lol)
 
Is this WinForms or WPF?
Also unless you do some surgery on config files, the CLR will limit your objects to being a max of 2GB in memory.

Best solution either way will be to display the file in chunks.
The process might look something like this:
  1. Read lines 1-10 of file.
  2. On scroll down, display lines 2-11 of the file.
Be careful of only keeping the lines that are being displayed in your array of lines, otherwise this will lead to a huge memory leak since we're not cleaning up the lines we're not showing and essentially loading in past that 2GB anyways. You can either set the string to null to trigger the garbage collector, or overwrite it in something like an array of strings with 10 elements.
 

Site & Scene News

Popular threads in this forum