Help with this (C# Code)

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

XabiPlayerPRO

Guest
OP
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?
 
X

XabiPlayerPRO

Guest
OP
It takes almost a minute with a 500kb file, so just with a 3gb file will be 6000 more times (lol)
 

Natorite

New Member
Newbie
Joined
Mar 31, 2017
Messages
4
Trophies
0
Location
USA
XP
21
Country
United States
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.
 
General chit-chat
Help Users
    KennieDaMeanie @ KennieDaMeanie: LA that explains alot