GithubHelp home page GithubHelp logo

runt18 / fbmemoryprofiler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookarchive/fbmemoryprofiler

0.0 2.0 0.0 1.79 MB

iOS tool that helps with profiling iOS Memory usage.

License: Other

Objective-C 91.37% Ruby 1.30% Objective-C++ 7.33%

fbmemoryprofiler's Introduction

FBMemoryProfiler

Carthage compatible CocoaPods

An iOS library providing developer tools for browsing objects in memory over time, using FBAllocationTracker and FBRetainCycleDetector.

About

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)

Installation

Carthage

To your Cartfile add:

github "facebook/FBMemoryProfiler"

FBMemoryProfiler is built out from non-debug builds, so when you want to test it, use

carthage update --configuration Debug

CocoaPods

To your podspec add:

pod 'FBMemoryProfiler'

You'll be able to use FBMemoryProfiler fully only in Debug builds. This is controlled by compilation flag that can be provided to the build to make it work in other configurations.

Usage

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:

#import <FBMemoryProfiler/FBMemoryProfiler.h>

FBMemoryProfiler *memoryProfiler = [FBMemoryProfiler new];
[memoryProfiler enable];

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

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

Plugins are objects that conform to FBMemoryProfilerPluggable protocol. Example usage: custom cache cleaners, loggers that log data to server.

Contributing

See the CONTRIBUTING file for how to help out.

fbmemoryprofiler's People

Contributors

absolute-heike avatar adelmezara avatar dahlgren avatar kastiglione avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.