开发者

What do you do when your application starts to run out of memory?

I have a C++ graphics app that does heavy computations on models. There is a leak or two which I've traced to CG and/or my ATI graphics card (I'm 100% SURE!!). The machi开发者_如何学运维ne I have has 16 GB ram, and when I've used 4.49 GB RAM (TOTAL system usage, with app only using ~1.9GB), vector.resize() starts returning 0 new elements and not being able to resize an array. Why so soon?


(Windows Assumed)

A 32-bit Windows application is limited to about 2.0 GB of user-mode memory (or 3.0 GB if certain boot-time parameters are set). When your application used up 1.9 GB of memory, the well ran dry.

Reference: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778(v=vs.85).aspx#memory_limits


I changed the build configuration to x64 and the application works fine


Throw an exception! Best to find and stamp on the leak, of course, but when you run out of memory: exception! To be extra cool restart your own application in response.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜