1

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?

Thomash
  • 6,339
  • 1
  • 30
  • 50
user1732445
  • 235
  • 2
  • 4
  • 14
  • “purge”'s effect is on the buffer cache. From “man purge”: “force disk cache to be purged (flushed and emptied).” – Pascal Cuoq Dec 01 '12 at 12:43
  • 1
    Incidentally, we were not at the System programming class you refer to, and we have no way to know whether “VM” is for Virtual Memory, Virtual Machine or something else. – Pascal Cuoq Dec 01 '12 at 12:45

1 Answers1

9

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.

Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187