首页 > 编程知识 正文

java 0x7fffffff,错误:数组的总大小不能超过0x7fffffff个字节

时间:2023-05-03 11:38:13 阅读:179523 作者:719

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!

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。