Why am I getting an Out Of Memory Exception in my C# application?

后端 未结 7 1355
梦谈多话
梦谈多话 2020-11-30 00:08

My memory is 4G physical, but why I got out of memory exception even if I create just 1.5G memory object. Any ideas why? (I saw at the same time, in the performance tab of t

7条回答
  •  悲&欢浪女
    2020-11-30 00:25

    You've got a max of 2Gb addressable memory as a 32bit app, as the other posters mentioned. Dont forget about overhead. You're creating an array of 93 million objects - if there happens to be 4 bytes of overhead per object that's an extra 350Mb of memory.

提交回复
热议问题