質問

I use mac machine, and I have a curiosity the concept of mac's purge command.

When I do that command, it frees of the memory that some like garbages (Is it really right?)

I have learnt Virtual Memory concept on 'System programming' this semester, but I don't know how this purge really do.

So my question is

  1. How to purge can distinguish still using allocated memory block and garbages?

  2. Is there any small implement or same function in C?

役に立ちましたか?

解決

You made me curious because I didn't know what was the purge command, so I typed man purge on a terminal:

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)

So it deletes cache.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top