large arrays and system.outofmemoryexception

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

    large arrays and system.outofmemoryexception

    assuming I have 2GB memory. And 1.5GB available.

    dim c1(,) as byte
    redim c1(1000, 1024*1024)

    throws system.outofmem oryexception. I'm like... huh? Initially I thought a
    lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....

    So, I read microsoft documents on this type of exception. Doesn't help much.
    They were saying to try and keep arrays to 64KB. But, that's not much to work
    with.

    I suspected that it's gotta do with 'available contiguous memory' and not
    just the total available memory. For example,

    redim c1(800, 1024*1024)
    redim c2(200, 1024*1024)
    may work but not...
    redim c1(500, 1024*1024)
    redim c2(500, 1024*1024)

    can someone shed some light on this? Sound like a .net memory oddity. ASP
    ..net seems to have similar problem (not with arrays though)
  • Cor Ligthert [MVP]

    #2
    Re: large arrays and system.outofmem oryexception

    Chad,

    If I have this kind of problems, than I start to investigate in what kind of
    a table will work and in what format not.

    However, probably is this what you are looking for.



    I hope this helps,

    Cor

    "chad" <chad@discussio ns.microsoft.co m> schreef in bericht
    news:3C1F26D9-3237-462E-B6F5-F865D6A0F01A@mi crosoft.com...[color=blue]
    > assuming I have 2GB memory. And 1.5GB available.
    >
    > dim c1(,) as byte
    > redim c1(1000, 1024*1024)
    >
    > throws system.outofmem oryexception. I'm like... huh? Initially I thought a
    > lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....
    >
    > So, I read microsoft documents on this type of exception. Doesn't help
    > much.
    > They were saying to try and keep arrays to 64KB. But, that's not much to
    > work
    > with.
    >
    > I suspected that it's gotta do with 'available contiguous memory' and not
    > just the total available memory. For example,
    >
    > redim c1(800, 1024*1024)
    > redim c2(200, 1024*1024)
    > may work but not...
    > redim c1(500, 1024*1024)
    > redim c2(500, 1024*1024)
    >
    > can someone shed some light on this? Sound like a .net memory oddity. ASP
    > .net seems to have similar problem (not with arrays though)[/color]


    Comment

    • chad

      #3
      Re: large arrays and system.outofmem oryexception

      hey Cor, thanks for the reply.
      [color=blue]
      > http://msdn.microsoft.com/library/de...ram_tuning.asp[/color]

      Ah, the /3GB thing. Yes, that was the first thing I tried after upping the
      memory from 2 to 4GB. Didn't work though. But, I seriously doubt that it's
      got anything to do with total memory.

      I think that .net just can't handle arrays that size :(

      Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
      array size. After upping to 4GB, it's still 800MB. So, I don't think it's the
      total physical memory. I investigated page file size too, as well as stopping
      unnecessary processes. Same thing. Oh well, sounds like recoding is the way
      to go. I'm just curious why it's like this.









      "Cor Ligthert [MVP]" wrote:
      [color=blue]
      > Chad,
      >
      > If I have this kind of problems, than I start to investigate in what kind of
      > a table will work and in what format not.
      >
      > However, probably is this what you are looking for.
      >
      > http://msdn.microsoft.com/library/de...ram_tuning.asp
      >
      > I hope this helps,
      >
      > Cor
      >
      > "chad" <chad@discussio ns.microsoft.co m> schreef in bericht
      > news:3C1F26D9-3237-462E-B6F5-F865D6A0F01A@mi crosoft.com...[color=green]
      > > assuming I have 2GB memory. And 1.5GB available.
      > >
      > > dim c1(,) as byte
      > > redim c1(1000, 1024*1024)
      > >
      > > throws system.outofmem oryexception. I'm like... huh? Initially I thought a
      > > lot of space is taken up by GC. So, I up my memory to 4GB. Same thing....
      > >
      > > So, I read microsoft documents on this type of exception. Doesn't help
      > > much.
      > > They were saying to try and keep arrays to 64KB. But, that's not much to
      > > work
      > > with.
      > >
      > > I suspected that it's gotta do with 'available contiguous memory' and not
      > > just the total available memory. For example,
      > >
      > > redim c1(800, 1024*1024)
      > > redim c2(200, 1024*1024)
      > > may work but not...
      > > redim c1(500, 1024*1024)
      > > redim c2(500, 1024*1024)
      > >
      > > can someone shed some light on this? Sound like a .net memory oddity. ASP
      > > .net seems to have similar problem (not with arrays though)[/color]
      >
      >
      >[/color]

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: large arrays and system.outofmem oryexception

        "chad" <chad@discussio ns.microsoft.co m> schrieb:[color=blue]
        > Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
        > array size. After upping to 4GB, it's still 800MB. So, I don't think it's
        > the
        > total physical memory. I investigated page file size too, as well as
        > stopping
        > unnecessary processes. Same thing. Oh well, sounds like recoding is the
        > way
        > to go. I'm just curious why it's like this.[/color]

        IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still
        is for .NET 2.0.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • chad

          #5
          Re: large arrays and system.outofmem oryexception

          > IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still[color=blue]
          > is for .NET 2.0.[/color]

          oh I see. that explains it then :-)
          thank you very much.



          "Herfried K. Wagner [MVP]" wrote:
          [color=blue]
          > "chad" <chad@discussio ns.microsoft.co m> schrieb:[color=green]
          > > Before I upped the memory, outofmemoryexce ption crashed out at 800MB of
          > > array size. After upping to 4GB, it's still 800MB. So, I don't think it's
          > > the
          > > total physical memory. I investigated page file size too, as well as
          > > stopping
          > > unnecessary processes. Same thing. Oh well, sounds like recoding is the
          > > way
          > > to go. I'm just curious why it's like this.[/color]
          >
          > IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe still
          > is for .NET 2.0.
          >
          > --
          > M S Herfried K. Wagner
          > M V P <URL:http://dotnet.mvps.org/>
          > V B <URL:http://classicvb.org/petition/>
          >
          >[/color]

          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: large arrays and system.outofmem oryexception

            "chad" <chad@discussio ns.microsoft.co m> schrieb:[color=blue][color=green]
            >> IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe
            >> still
            >> is for .NET 2.0.[/color]
            >
            > oh I see. that explains it then :-)[/color]

            Additional information on this topic can be found here (text is in German,
            but links reference articles written in English):

            <URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • chad

              #7
              Re: large arrays and system.outofmem oryexception

              <URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>

              Awesome! Especially the 2nd article. It explains a lot about memory issues.

              thanks again. You're the best :-)


              "Herfried K. Wagner [MVP]" wrote:
              [color=blue]
              > "chad" <chad@discussio ns.microsoft.co m> schrieb:[color=green][color=darkred]
              > >> IIRC ~ 800 MB was the per-process memory limit for .NET 1.*, and maybe
              > >> still
              > >> is for .NET 2.0.[/color]
              > >
              > > oh I see. that explains it then :-)[/color]
              >
              > Additional information on this topic can be found here (text is in German,
              > but links reference articles written in English):
              >
              > <URL:http://groups.google.d e/group/microsoft.publi c.de.german.ent wickler.dotnet. csharp/msg/1e14bd8b0886e36 c>
              >
              > --
              > M S Herfried K. Wagner
              > M V P <URL:http://dotnet.mvps.org/>
              > V B <URL:http://classicvb.org/petition/>
              >
              >[/color]

              Comment

              Working...