Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
long a[100000][100000];
getting error as array size is too large.
how can i remove this error
Posted

How many times are you guys going to post these questions when they are being answered in other questions you've posted. Go back and read the answer to your other questions first.(I want 2D array that can store 1000000 integers[^])

Also, in your question remove a simple error or warning in this program please[^] you said you needed to use malloc(). Now you're showing a simple array declaration. Which is it?
 
Share this answer
 
v2
why do you need such a big array to store your date?It will occupy a lot of RAM,so it is hard for the program to work normally。
 
Share this answer
 
Comments
OriginalGriff 6-Sep-11 4:01am    
Have you worked out how much RAM? :laugh:
80GB! Now, I wouldn't mind a PC with that much, but...
CHINA PING 6-Sep-11 4:16am    
you do not mind?but fact is fact and how much RAM does your PC have?my laptop is with 2GB。maybe if your parents are the leaders of IBM,you can have a PC with that much!
long: 8 bytes.
array of 100,000 longs: 800,000 bytes (plus overhead)
array of 100,000 arrays of 100,000 longs: 80,000,000,000 bytes (plus lots more overhead)

80 GB of array is rather a lot to assign or use at a single time. I strongly suggest that you redesign your system, because it would be unworkably slow to use unless you have 85GB of RAM or more installed in your PC...
 
Share this answer
 
IF you are using such a huge array but not assigning all the elements to it, you should be using a generic collection rather than an array.
An array will use memory for each array element even when it is not being used.
You will get rid of the error as well.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900