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

后端 未结 9 909
旧巷少年郎
旧巷少年郎 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:11

    I once had a student in CS 1 (in C, yeah, yeah, not my fault) try this, and ran out of memory:

    int array[42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42][42]..... (42 dimensions);
    

    and then he wanted to know why it gave errors...

提交回复
热议问题