ihaveasmallcprogramthatrequiresalarge 2d array。
int distanceArray[282][9900000];
iamawarethatastandard 32 bitconsoleapplicationwouldbeunabletoallocatethismuchmemorytomyprocessduetothe2gbc apon 32 bit appplicati ons despitethefactthatihaveconfiguredmycompilertousethenativeamd 64 toolset,istillgetthesameerrorwhenitrytobuildmy
errorc 2148 totalsizeofarraymustnotexceed0x7fffff bytes
I have 16GB of RAM on my system,soiknowthatmyphysicalmemoryshouldnotbeanissue.ifmycalculationsarecorrect,thisshouldonlytakeuparect id on ' tunderstandwhyican ' tseemtogetthe 64 bitcompilertoworkcorrectly.ihavefollowedthedirectionsonmicrosoft ' swebsitetethatoutoutthattttoured but no matter what I do,ireceivethesameerror.anyhelpwouldbegreatlyappreciated.thank you!
iamawarethatthisquestionhasbeenaskedbefore,buttheexistinganswershavenotbeenhelpfultome.thankyouforanyattemptathelpingmefing
解决方案
As suggested by MSalters,anstd :3360 vector : vectorwasdefinitelythewaytogo。
foranyonewhoisstillhavingthisproblem,here is how I initialized it:
STD : vector : vectordistancearray (282,STD3360:vector ) 9000000,-1;
9,000,000 columnsarecreatedwithineveryrowof 282 items,andeachvalueisinitializedto-1 at the start。
thankstoeveryonewhocommentedforthehelp!