How do I force a program to appear to run out of memory?

后端 未结 9 922
旧巷少年郎
旧巷少年郎 2020-12-24 07:39

I have a C/C++ program that might be hanging when it runs out of memory. We discovered this by running many copies at the same time. I want to debug the program without co

9条回答
  •  借酒劲吻你
    2020-12-24 08:04

    • Which OS? For Unix, see ulimit -d/limit datasize depending on your shell (sh/csh).

    • You can write a wrapper for malloc which returns an error in the circonstance you want. Depending on your OS, you may be able to substitute it for the implementation's one.

提交回复
热议问题