It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened,
visit the help center。
6年前关闭。
我使用mac机器,我对mac的清除命令的概念很好奇。
当我执行这个命令时,它会释放一些像垃圾一样的记忆(真的是对的吗?)
这学期我学习了“系统编程”中的虚拟内存概念,但我不知道这种清除是如何做到的。
所以我的问题是
如何清除仍在使用的内存块和垃圾?
C语言中是否有小的实现或相同的功能?
最佳答案:
你让我好奇,因为我不知道什么是清除命令,所以我在终端上键入man purge:
NAME
purge -- force disk cache to be purged (flushed and emptied)
SYNOPSIS
purge
DESCRIPTION
Purge can be used to approximate initial boot conditions with a cold disk
buffer cache for performance analysis. It does not affect anonymous mem-
ory that has been allocated through malloc, vm_allocate, etc.
SEE ALSO
sync(8), malloc(3)
所以它删除缓存。