answersLogoWhite

0


Best Answer

The maximum size of an array in C++ is the same as the maximum number that can be represented by an int (usually 2,147,483,647 elements, or just over 2 billion). An int is defined as being dependent on a CPU's architecture, so the 2 billion number is based on 32-bit compilation. Some 64-bit processors also compile to a 32-bit int, and would be limited to just over 2 billion elements.

Available memory is also a consideration on the maximum size of an array. The larger the elements, the fewer elements you can achieve. This is unlikely to be a problem on 64-bit systems, but on 32-bit systems it could be.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Platform-dependent.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Maximum static memory size in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you overload static methods in Java?

Yes you can overload the static method. But it should be avoided because memory to static methods are allocated at the time of class load.....so memory will be wasted if we don't use that methods. Whereas non-static method memory allocation depends on Object


How do you calculate the size of a class in memory in C plus plus?

Use sizeof( ).


Does adding the static keyword to the declaration of these variables in your program change their size?

No. The static keyword only specifies the way a method is declared, used and handled by the JVM and the other classes and does not modify the size it occupies in the memory.


What is the maximum number of nodes that you can have on a stack linked list?

You can have as many as you can fit in memory, which is dependent on size of each node, OS, amount of RAM, etc.


When is memory allocated when declaring an array in C plus plus?

It depends how the array is declared (fixed size or variable size) and where it is declared (global scope or local scope). If the array is declared in global scope (outside a function) and is fixed size, it will be allocated in static memory. If it is variable size, the pointer is stored in static memory while the array itself is allocated on the heap. The pointer in static memory points to the start address of the array in heap memory. If the array is declared in local scope (inside a function) and is fixed size, it will be allocated on the stack in whichever thread the function was called. If it is variable size, the local pointer is stored on the stack while the array is allocated on the heap. The pointer will fall from scope when the function returns so the array must not be allowed to outlive the function in which the pointer is declared. If the array must outlive the function that allocates the array, the pointer must be declared at a higher scope in the call stack and must be passed by reference to or returned by value from the function that allocates the array. If you provide your own memory manager, however, an array may be allocated wherever the memory manager's memory pool is allocated, be it in static memory, the stack or the heap. A memory manager essentially allocates an array of bytes which you can then utilise as you see fit (the array of bytes will be allocated as per the previous description for arrays in general).

Related questions

What is static memory management?

static memory management i.e we are fixed the memory location with there size & that fixed size jobs will appear


What is the maximum size of else-if ladder in c plus plus?

There is no preset limit on the size of an else-if ladder in C++. It depends on compiler design and available memory.


What is memory management?

static memory management i.e we are fixed the memory location with there size & that fixed size jobs will appear


What is the maximum size of memory available for dynamic memory allocation?

The maximum memory that can be dynamically allocated depends on the size of the heap memory. Dynamic blocks of memory can be allocated in system heap until it is not full.


What is maximum memory for n82?

The maximum size of the microSD card on the N82 is 8GB.


Can you overload static methods in Java?

Yes you can overload the static method. But it should be avoided because memory to static methods are allocated at the time of class load.....so memory will be wasted if we don't use that methods. Whereas non-static method memory allocation depends on Object


How much memory does a DSTT?

it depends on the size of the memory card inserted into the DSTT. The maximum is 4 Gig.


How do you calculate the size of a class in memory in C plus plus?

Use sizeof( ).


What can be the maximum size of virtual memory?

That depends on the operating system and computer architecture.


What is the recommended size of cache memory in a processor?

The maximum size of a cache memory is theoretically equal to the amount of primary memory(RAM).Like Cache only memory architecture where the whole memory space is filled up with the cache only.


Does adding the static keyword to the declaration of these variables in your program change their size?

No. The static keyword only specifies the way a method is declared, used and handled by the JVM and the other classes and does not modify the size it occupies in the memory.


How much is the maximum capacity for a micro SD memory card?

Having had a good look on eBay - the maximum size appears to be 32GB.