Is “Out Of Memory” A Recoverable Error?

后端 未结 24 2100
闹比i
闹比i 2020-11-30 21:44

I\'ve been programming a long time, and the programs I see, when they run out of memory, attempt to clean up and exit, i.e. fail gracefully. I can\'t remember the last time

24条回答
  •  佛祖请我去吃肉
    2020-11-30 22:13

    It is recoverable only if you catch it and handle it correctly.

    In same cases, for example, a request tried to allocate a lot memory. It is quite predictable and you can handle it very very well.

    However, in many cases in multi-thread application, OOE may also happen on background thread (including created by system/3rd-party library). It is almost imposable to predict and you may unable to recover the state of all your threads.

提交回复
热议问题