Skip to content

an easy way to show the memory cost in your UIImageView.在 UIImageView 中显示图片占用的内存大小。

License

Notifications You must be signed in to change notification settings

Liaoworking/GHImageMemoryCostDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GHImageMemoryCostDetector

an easy way to show the memory cost in your UIImageView, as a reference, to optimise app's memory usage.

Swift Version Swift Version Plaform

Installation

Simply add Source folder with files to your project.

Usage example

image

image

You can find example projects here

Start

You just only initialize in your appDelegate.m When your App are launching. Objective-C usage

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [UIImageView showMemoryCost];
    return YES;
}

Swift usage

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        UIImageView.showMemoryCost()
        return true
    }

And then, you can all the imageView memory usage in every imageView.

Support

UIImageView and it's subclass, like: SDAnimatedImageView.

Performance

GHImageMemoryCostDetector just add a lightweight text layer in your original imageView.

The total time consuming of UIImageView image set event for 20000 times:

image

Testing Environment: iPhone X

System Version: iOS 13.4.1

Unit of Time : s

Features

  • This framework only contains two files

    UIImageView+MemDetector.h

    UIImageView+MemDetector.m

  • Easy to use and uninstall.

  • At release mode, there will be no more any memory detection in your UIImageView.

About

an easy way to show the memory cost in your UIImageView.在 UIImageView 中显示图片占用的内存大小。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published