Authored by 戴强

Merge branch 'dev_master' into 'master'

暴露内存状态查询接口



See merge request !20
@@ -14,4 +14,8 @@ FOUNDATION_EXTERN NSString *const YH_MemroyMetricsEnableKey; @@ -14,4 +14,8 @@ FOUNDATION_EXTERN NSString *const YH_MemroyMetricsEnableKey;
14 14
15 + (void)setMemoryStatusMonitorEnable:(BOOL)enable; 15 + (void)setMemoryStatusMonitorEnable:(BOOL)enable;
16 16
  17 ++ (NSUInteger)appUsedMemory;
  18 ++ (NSUInteger)allUsedMemory;
  19 ++ (NSUInteger)availableMemory;
  20 +
17 @end 21 @end
@@ -68,7 +68,6 @@ static YH_DeviceInfoMonitor *yh_globalDeviceInfoMonitor = nil; @@ -68,7 +68,6 @@ static YH_DeviceInfoMonitor *yh_globalDeviceInfoMonitor = nil;
68 68
69 - (void)dealloc { 69 - (void)dealloc {
70 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil]; 70 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
71 - [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];  
72 } 71 }
73 72
74 #pragma mark - utilites 73 #pragma mark - utilites
@@ -123,4 +122,16 @@ static YH_DeviceInfoMonitor *yh_globalDeviceInfoMonitor = nil; @@ -123,4 +122,16 @@ static YH_DeviceInfoMonitor *yh_globalDeviceInfoMonitor = nil;
123 return vm_page_size * (vmStats.free_count + vmStats.inactive_count); 122 return vm_page_size * (vmStats.free_count + vmStats.inactive_count);
124 } 123 }
125 124
  125 ++ (NSUInteger)appUsedMemory {
  126 + return [yh_globalDeviceInfoMonitor appUsedMemory];
  127 +}
  128 +
  129 ++ (NSUInteger)allUsedMemory {
  130 + return [yh_globalDeviceInfoMonitor allUsedMemory];
  131 +}
  132 +
  133 ++ (NSUInteger)availableMemory {
  134 + return [yh_globalDeviceInfoMonitor availableMemory];
  135 +}
  136 +
126 @end 137 @end