On Aug 28, 2008, at 00:31 , Alex Kac wrote:

I need to check for free RAM before performing a specific operation. I've Googled and checked in the docs and I suspect its my terminology that's just out of whack.

So what is the best way to find out how much available RAM is available in a Cocoa app?

You can also get some information with these calls, although I don't know how useful it will be in your situation:

// Amount of physical memory installed -- requires 10.5
unsigned long long memory = [[NSProcessInfo processInfo] physicalMemory];

// Amount of memory allocated to user space
unsigned long long memory;
size_t mem_len = sizeof(memory);
int mib[2];

mib[0] = CTL_HW;
mib[1] = HW_USERMEM;
if( sysctl(mib, 2, &memory, &mem_len, NULL, 0) == -1 ) {
 perror("sysctl");
}

It doesn't really tell you about what's actually available to the application, though :/

J

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to