|
@@ -0,0 +1,22 @@
|
|
|
|
+//
|
|
|
|
+// MemoryCoculation.m
|
|
|
|
+// BFFramework
|
|
|
|
+//
|
|
|
|
+// Created by Harry Hu on 2021/10/13.
|
|
|
|
+//
|
|
|
|
+
|
|
|
|
+#import "MemoryCoculation.h"
|
|
|
|
+
|
|
|
|
+@implementation MemoryCoculation
|
|
|
|
+
|
|
|
|
++ (int64_t)memoryResidentSize {
|
|
|
|
+ struct task_basic_info info;
|
|
|
|
+// mach_msg_type_number_t size = sizeof(task_basic_info_data_t) / sizeof(natural_t);
|
|
|
|
+// kern_return_t ret = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size);
|
|
|
|
+// if (ret != KERN_SUCCESS) {
|
|
|
|
+// return 0;
|
|
|
|
+// }
|
|
|
|
+ return info.resident_size;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+@end
|