Skip to content

Instantly share code, notes, and snippets.

@robterrell
Created April 29, 2014 22:10
Show Gist options
  • Select an option

  • Save robterrell/1feb8ea5f9b27428b8dd to your computer and use it in GitHub Desktop.

Select an option

Save robterrell/1feb8ea5f9b27428b8dd to your computer and use it in GitHub Desktop.
HWUtils_getUsedMemory
const int HWUtils_getUsedMemory()
{
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(task_basic_info);
kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);
return (kerr == KERN_SUCCESS) ? (int)info.resident_size : 0; // size in bytes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment