Re: Array size limits

From: Carol Depore (nobody_at_nowhere.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 03:27:55 GMT

On Mon, 30 Aug 2004 21:48:07 -0500, Jack Klein <jackklein@spamcop.net>
wrote:

>On Tue, 31 Aug 2004 02:08:08 GMT, Carol Depore <nobody@nowhere.com>
>wrote in comp.lang.c:
>
>> How do I determine the maximum array size?
>
>You can't
>
>> For example, int a[10000] works, but a[10000000] does not (run time
>> error).
>>
>> Thank you.
>
>The original C standard (ANSI 1989/ISO 1990) required that a compiler
>successfully translate at least one program containing at least one
>example of a set of environmental limits. One of those limits was
>being able to create an object of at least 32,767 bytes.
>
>This minimum limit was raised in the 1999 update to the C standard to
>be at least 65,535 bytes.
>
>No C implementation is required to provide for objects greater than
>that size, which means that they don't need to allow for an array of
>ints greater than (int)(65535 / sizeof(int)).

So...are you saying that I am guaranteed at least int a[65535], but no
guarantees beyond that?

>
>In very practical terms, on modern computers, it is not possible to
>say in advance how large an array can be created. It can depend on
>things like the amount of physical memory installed in the computer,
>the amount of virtual memory provided by the OS, the number of other
>tasks, drivers, and programs already running and how much memory that
>are using. So your program may be able to use more or less memory
>running today than it could use yesterday or it will be able to use
>tomorrow.
>
>Many platforms place their strictest limits on automatic objects, that
>is those defined inside of a function without the use of the 'static'
>keyword. On some platforms you can create larger arrays if they are
>static or by dynamic allocation.



Relevant Pages

  • Re: Fast string operations
    ... Looping: I thought looping over arrays in managed code was "slow" ... array handling and such. ... The problem with TrimHelper is that it always returns a new string instance. ... The customer perceives this as a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: High Memory Consumption of Classes and Arrays
    ... Only the array itself has overhead. ... memory as a reference type. ... > least consume 40 bytes of memory. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.mfc)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.language)
  • Re: 100k X 100k data processing summary
    ... The problem is I don't know where the algorithm gets wrong. ... I've changed a lot from 2D array to 1D array to pointer. ... when we are talking about>500M memory today. ... You're modifiying the *soft* limits, ...
    (comp.lang.c)