Re: Memory Limit for Visual Studio 2005???

Tech-Archive recommends: Fix windows errors by optimizing your registry




"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:eOOSzggJHHA.4244@xxxxxxxxxxxxxxxxxxxxxxx
"Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote in message
news:RHVih.128727$xM4.15597@xxxxxxxxxxxxxxx

"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:%23mAxnRfJHHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
"Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote in message
news:HPUih.128718$xM4.75416@xxxxxxxxxxxxxxx

"Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:%23yLni8eJHHA.5104@xxxxxxxxxxxxxxxxxxxxxxx
"Peter Olcott" <NoSpam@xxxxxxxxxxxxx> wrote in message
news:RKQih.33440$B42.17767@xxxxxxxxxxxxxxx
It looks like System::Collections::Generic.List throws and OUT_OF_MEMORY
exception whenever memory allocated exceeds 256 MB. I have 1024 MB on my
system so I am not even out of physical RAM, much less virtual memory.

Are other people experiencing this same problem?




Why do you mention VS2005? This is thrown at program run-time, right? The
run-time limitation is 2GB for a CLR object type, that means that your
List can only hold at most 2GB, however, due heap fragmentation of a 32
bit process, the maximum size of a single object is limited to something
from 1.2GB up to 1.8GB depending on the type of OS and application. A
simple console application should be able to allocate a single List of
~1.6GB or more , Windows Forms will top at ~1.2GB for the largest List (or
array or whatever).

Willy.

If you have actually tested this and thus know that it works empirically
rather than theoretically, then this must be a limitation of Visual Studio
2005 Express. I could not get Visual Studio 2005 Express to allocate more
than 256 MB without abnormally terminating.

I was very pleased with its relative performance to Native Code Visual C++
6.0. It was something like 50% faster on every test.

No, once again this is run-time related VS does (and can't impose such
restrictions) , try to compile and run your code from the command-line
prompt if you do't trust me.
Keep in mind that when you don't pre-allocate the List, you will end with a
List doubling it's size each time it get's filled to the max. capacity, so
the OOM exception might get thrown when no free *contiguous* block of ~512MB
can be found in excess of the already allocated ~256MB.

Willy.





Willy.



It works fine for native code std::vector, yet does not work for either
managed std::vector or List<Byte> . The command line version failed to
compile.



There is no such thing like MANAGED std::vector,

Yes, there is just recently. This saves old C++ programmers like me alot of
learning curve switching to .NET.

and the program should compile just fine from the command line. if it compiles
from VS. Both VS and the csc.exe are both driving the same compiler.

Willy.




.



Relevant Pages

  • Re: Memory Limit for Visual Studio 2005???
    ... whenever memory allocated exceeds 256 MB. ... I could not get Visual Studio 2005 Express to allocate more than 256 MB without abnormally terminating. ... I was very pleased with its relative performance to Native Code Visual C++ 6.0. ... the std::vector template will compile as a native class .Try to compile in pure managed mode /clr:safe and it will fail. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Memory Limit for Visual Studio 2005???
    ... OUT_OF_MEMORY exception whenever memory allocated exceeds 256 MB. ... allocate more than 256 MB without abnormally terminating. ... I was very pleased with its relative performance to Native Code Visual ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Memory Limit for Visual Studio 2005???
    ... whenever memory allocated exceeds 256 MB. ... If you have actually tested this and thus know that it works empirically rather than theoretically, then this must be a limitation of Visual Studio 2005 Express. ... I could not get Visual Studio 2005 Express to allocate more than 256 MB without abnormally terminating. ... There is no such thing like MANAGED std::vector, and the program should compile just fine from the command line. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Memory Limit for Visual Studio 2005???
    ... exception whenever memory allocated exceeds 256 MB. ... I could not get Visual Studio 2005 Express to allocate more ... I was very pleased with its relative performance to Native Code Visual C++ ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Technical two dimensional array question
    ... > Does it allocate a contiguous blocks of memory or not? ... What it allocates is memory space for *references* to string objects, ... > I tried it and I get an exception error, as I should, but, ... allocated array. ...
    (microsoft.public.dotnet.languages.csharp)