// 获得当前 App 的内存占用情况
- (NSUInteger)getResidentMemory
{
structtask_basic_infot_info;
mach_msg_type_number_tt_info_count = TASK_BASIC_INFO_COUNT;
int r = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
if(r == KERN_SUCCESS)
{
NSLog(@"resident_size %lu",t_info.resident_size /1024/1024);
return t_info.resident_size;
}else
{return-1; }}