TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | BSD |
ReleasedLast Release | May 2016 |
Maintained by Dave Lee, Grzegorz Pstrucha, Jeremie Marguerie.
Depends on: | |
FBRetainCycleDetector | ~> 0.1 |
FBAllocationTracker | ~> 0.1 |
An iOS library providing developer tools for browsing objects in memory over time, using FBAllocationTracker and FBRetainCycleDetector.
This library shows how FBAllocationTracker
and FBRetainCycleDetector
can cooperate together, and how they can be used in real app.
It uses FBAllocationTracker to gather information about the objects. It supports generations and retain cycle detection.
Here is a small demo (project is available in Example directory)
To start using FBMemoryProfiler
you'll first need to enable FBAllocationTracker
.
#import <FBAllocationTracker/FBAllocationTrackerManager.h>
int main(int argc, char * argv[]) {
[[FBAllocationTrackerManager sharedManager] startTrackingAllocations];
[[FBAllocationTrackerManager sharedManager] enableGenerations];
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
To enable memory profiler:
FBMemoryProfiler *memoryProfiler = [FBMemoryProfiler new];
[memoryProfiler enable];
FBMemoryProfiler
will show up as a button on the screen. Once tapped, it will open memory profiler in full size mode.
We can also define plugins (check below) and filters for retain cycle detector, that we pass to configuration.
_memoryProfiler = [[FBMemoryProfiler alloc] initWithPlugins:@[[IncredibleCacheCleaningPlugin new],
[AwesomeLoggerPlugin new]]
retainCycleDetectorConfiguration:someConfigurationWithCustomFilters;
[_memoryProfiler enable];
Plugins are objects that conform to FBMemoryProfilerPluggable protocol. Example usage: custom cache cleaners, loggers that log data to server.
See the CONTRIBUTING file for how to help out.