Latest 1.6.2
License MIT
Platforms ios 8.0, requires ARC
Dependencies FBMemoryProfiler, FBAllocationTracker, FBRetainCycleDetector
Frameworks UIKit, Foundation

A memory tool for easy browsing viewControllers in memory over time, using FBMemoryProfiler and FBAllocationTracker and FBRetainCycleDetector.


It also can detect retain cycles of viewControllers.

Here is a small demo



To your podspec add:

pod 'ZJMemoryProfiler'


To start using ZJMemoryProfiler 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:

#import <ZJMemoryProfiler/ZJMemoryProfiler.h>

ZJMemoryProfiler *memoryProfiler = [ZJMemoryProfiler sharedProfiler];
[memoryProfiler enable];

// Store memory profiler somewhere to extend it's lifetime
_memoryProfiler = memoryProfiler;

Add method to get viewControlls witch you want to browse:

#import <ZJMemoryProfiler/ZJMemoryProfiler.h>

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [[ZJMemoryProfiler sharedProfiler] updateViewControllerInfo:self];

ZJMemoryProfiler will show up as a view on the screen. Once tapped, it will recheck the memory usage of current viewController. Double tapped, it will open FBMemoryProfiler in full size mode.

We can also define plugins (check below) and filters for retain cycle detector, that we pass to configuration.

#import <FBRetainCycleDetector/FBStandardGraphEdgeFilters.h>

NSArray *filters = @[FBFilterBlockWithObjectIvarRelation([UIView class], @"_subviewCache")];
FBObjectGraphConfiguration *configuration = [[FBObjectGraphConfiguration alloc] initWithFilterBlocks:filters
ZJMemoryProfiler *memoryProfiler = [ZJMemoryProfiler sharedProfiler];
memoryProfiler.enableCheckRetainCycles = YES;      // You must enable this fun.
memoryProfiler.fbPlugins = filters;
memoryProfiler.retainCycleDetectorConfiguration = configuration;
[memoryProfiler enable];

We can also add an interval time to check memory automatically.

memoryProfiler.autoCheckIntervalSeconds = 5;


For more details: FBMemoryProfiler

Latest podspec

    "name": "ZJMemoryProfiler",
    "version": "1.6.2",
    "summary": "A memory profiler base on FBMemoryProfiler.",
    "description": "A memory profiler base on FBMemoryProfiler that can show app memory usage andndetect retain cycles of current top view controller.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Melody": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "1.6.2"
    "source_files": "ZJMemoryProfiler/*.{h,m,mm}",
    "frameworks": [
    "requires_arc": true,
    "dependencies": {
        "FBMemoryProfiler": [
            "~> 0.1.3"
        "FBAllocationTracker": [
            "~> 0.1.5"
        "FBRetainCycleDetector": [
            "~> 0.1.2"

Pin It on Pinterest

Share This