开发者

How to get the amount of free virtual memory on Apple / Mac?

How do I get the amount of free virtual memory on Mac OSX?

I'm speaking of total free virtual memory (or: free addresses) and also the biggest allocatable continou开发者_JAVA技巧s block of memory available for the current process.

(Like e.g. on Windows returned by GlobalMemoryStatus (free mem) or querieable with a combination of GetSystemInfo / VirtualQuery (biggest block))

EDIT: this is to monitor the memory fragmentation and be alerted of areas or situations, where this gets really bad. Targeting (also) 32 bit.


In short, you can't. Mostly because it isn't a useful number as it changes all the time and, for 64 bit applications, if you tried to use a many GB (or many TB) allocation, you'd swap to death anyway.

What are you trying to do?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜