Recently, I’ve found out that Darwin has
speculative memory metric. But, I don’t know what the purpose of speculative memory. The memory metric can be checked using
vm_stat command on terminal.
Mach Virtual Memory Statistics: (page size of 4096 bytes) Pages free: 334212. Pages active: 1450252. Pages inactive: 1367584. Pages speculative: 81968. Pages throttled: 0. Pages wired down: 794478. Pages purgeable: 377078. "Translation faults": 1584392481. Pages copy-on-write: 316685071. Pages zero filled: 358257445. Pages reactivated: 9976919. Pages purged: 2557552. File-backed pages: 597869. Anonymous pages: 2301935. Pages stored in compressor: 1170377. Pages occupied by compressor: 165553. Decompressions: 7496783. Compressions: 14958548. Pageins: 29715699. Pageouts: 1058099. Swapins: 6422438. Swapouts: 7169648.
Refer to Darwin source,
speculative is that used to hold pages that have been read from disk speculatively and the memory metric is the number of
free pages and havent’ actaually been used.
I can’t find any information about
speculative memory on the Internet. It’s very strange that the memory is an official darwin memory metric, but no one says for it.
What’s the purpose of this mertric unless used for any purpose?