我需要关于如何编写一个保留指定数量的 MB RAM 的 C 程序的想法,直到一个键 [例如。在 Linux 2.6 32 位系统上按下任意键]。
*
/.eat_ram.out 200
# If free -m is execute at this time, it should report 200 MB more in the used section, than before running the program.
[Any key is pressed]
# Now all the reserved RAM should be released and the program exits.
*
这是程序的核心功能 [保留 RAM] 我不知道该怎么做,从命令行获取参数,打印 [任何键被按下] 等等对我来说都不是问题。
关于如何做到这一点的任何想法?