Help with this (C# Code)

Discussion in 'Computer Programming, Emulation, and Game Modding' started by XabiPlayerPRO, Mar 19, 2017.

  1. XabiPlayerPRO

    XabiPlayerPRO Newbie

    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?
  2. XabiPlayerPRO

    XabiPlayerPRO Newbie

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

    Natorite Newbie

    Mar 31, 2017
    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.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice