Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array memory cap

Status
Not open for further replies.

raven111

Programmer
Apr 22, 2005
3
US
Hi,

Im using Borland BulderX, and my program crashes when I declare a large array.

For example:

int main() {
int arra[2000][20][20];
cout << "DOES NOT REACH HERE!\n";
}

The program compiles alright but exits as soon as it hits the array declaration. I would guess there is some kind of a memory cap.

I really hope someone could help me out.

Thanks

raven001

 
The memory cap is the amount of memory you have. You are allocating over 780 MB. Even if you have 1GB of RAM, a lot of stuff is being stored there.

I would recommend looking at vectors, deques, etc. They will allocate memory as you need it.

If you have to use arrays, look at dynamic arrays. Static arrays are great for small items but for for large amounts of memory, it's better to use something else.

James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
Opps! You're right. That's what happens when you do math in your head. [blush]

James P. Cottingham
-----------------------------------------
To determine how long it will take to write and debug a program, take your best estimate, multiply that by two, add one, and convert to the next higher units.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top