Array Capacity > 2Gb ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Reizlein

    Array Capacity > 2Gb ?

    Im making a MD5 file checking program and im trying to read a file which is
    larger than 2Gb. and i come across the problem that Arrays in VB.net cannot
    have more than 2gb capacity, when i try to create an array of the file
    length i get an overflow. is that possible? is there any workaround?

    I know its going to be a lot of memory consumming to load all the file into
    an array but i just dont care about that.
    Any suggestions?

    Thanks,
    Smoke

  • Andrew Morton

    #2
    Re: Array Capacity > 2Gb ?

    Christian Reizlein wrote:
    Im making a MD5 file checking program and im trying to read a file
    which is larger than 2Gb. and i come across the problem that Arrays
    in VB.net cannot have more than 2gb capacity, when i try to create an
    array of the file length i get an overflow. is that possible? is
    there any workaround?
    I know its going to be a lot of memory consumming to load all the
    file into an array but i just dont care about that.
    Any suggestions?
    You could read the file in chunks of, say, 32KB (seeing as that's the size
    of the OS's buffer AFAIK).

    Andrew


    Comment

    • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

      #3
      RE: Array Capacity > 2Gb ?

      You shouldn't need the entire file in memory at once to do that...

      "Christian Reizlein" wrote:
      Im making a MD5 file checking program and im trying to read a file which is
      larger than 2Gb. and i come across the problem that Arrays in VB.net cannot
      have more than 2gb capacity, when i try to create an array of the file
      length i get an overflow. is that possible? is there any workaround?
      >
      I know its going to be a lot of memory consumming to load all the file into
      an array but i just dont care about that.
      Any suggestions?
      >
      Thanks,
      Smoke
      >

      Comment

      • Christian Reizlein

        #4
        Re: Array Capacity > 2Gb ?

        Well, im reading it in chunks, but anyway i need a array of bytes to use as
        buffer to put the read contents and that has to be the total lenght of the
        file

        "Andrew Morton" <akm@in-press.co.uk.inv alidwrote in message
        news:66477dF2ja 14pU1@mid.indiv idual.net...
        Christian Reizlein wrote:
        >Im making a MD5 file checking program and im trying to read a file
        >which is larger than 2Gb. and i come across the problem that Arrays
        >in VB.net cannot have more than 2gb capacity, when i try to create an
        >array of the file length i get an overflow. is that possible? is
        >there any workaround?
        >I know its going to be a lot of memory consumming to load all the
        >file into an array but i just dont care about that.
        >Any suggestions?
        >
        You could read the file in chunks of, say, 32KB (seeing as that's the size
        of the OS's buffer AFAIK).
        >
        Andrew
        >

        Comment

        • Tom Shelton

          #5
          Re: Array Capacity &gt; 2Gb ?

          On 2008-04-09, Christian Reizlein <creizlein@hotm ail.comwrote:
          Thanks you so much for your tips, i where able to override the read method
          of the filestream and raise events and control the data beign readed trough
          the position property, i didnt figured that out early.
          >
          Thanks once again :)
          >
          I'm glad it helped :)

          --
          Tom Shelton

          Comment

          Working...