Created
November 4, 2011 14:33
-
-
Save beelsebob/1339457 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| struct task_basic_info info; | |
| mach_msg_type_number_t size = sizeof(info); | |
| kern_return_t kerr = task_info(mach_task_self(), | |
| TASK_BASIC_INFO, | |
| (task_info_t)&info, | |
| &size); | |
| if (kerr == KERN_SUCCESS) | |
| { | |
| static vm_size_t last_resident_size = 0; | |
| if(last_resident_size != info.resident_size) | |
| { | |
| last_resident_size = info.resident_size; | |
| NSLog(@"Memory usage: %u", last_resident_size); | |
| } | |
| static natural_t last_virtual_size = 0; | |
| if(last_virtual_size != info.virtual_size) | |
| { | |
| last_virtual_size = info.virtual_size; | |
| NSLog(@"Virtual memory usage: %u", last_virtual_size); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment