MemoryCoculation.m 504 B

12345678910111213141516171819202122
  1. //
  2. // MemoryCoculation.m
  3. // BFFramework
  4. //
  5. // Created by Harry Hu on 2021/10/13.
  6. //
  7. #import "MemoryCoculation.h"
  8. @implementation MemoryCoculation
  9. + (int64_t)memoryResidentSize {
  10. struct task_basic_info info;
  11. // mach_msg_type_number_t size = sizeof(task_basic_info_data_t) / sizeof(natural_t);
  12. // kern_return_t ret = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);
  13. // if (ret != KERN_SUCCESS) {
  14. // return 0;
  15. // }
  16. return info.resident_size;
  17. }
  18. @end