Skip to content
This repository was archived by the owner on Feb 27, 2019. It is now read-only.

A circular reference bug fix suggestion and a Chinese internationalization file support#239

Open
DeveloperJx wants to merge 2 commits into
nickoneill:masterfrom
DeveloperJx:master
Open

A circular reference bug fix suggestion and a Chinese internationalization file support#239
DeveloperJx wants to merge 2 commits into
nickoneill:masterfrom
DeveloperJx:master

Conversation

@DeveloperJx

Copy link
Copy Markdown

I found a slight problem may cause memory leak,and here are the steps to reproduce:
Firstly,open your example project.Then open the Main.Storyboard and add a storyboard id to the layout of ViewController as shown in the screenshot:
1
Secondly,open AppDelegate add source code UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "test") to the callback method "didFinishLaunchingWithOptions" as shown in the screenshot:
2
Finally,run the app,then you can see xcode detects a memory leak form the member variables of PermissionScope as shown in the screenshot:
3

So,I suggest to add a weak mark to the member variable named viewControllerForAlerts of PermissionScope.And hope it could eliminate the risk of memory leaks.

Thanks for your open source library!And hope you have a nice day!

by:Jason (China 2017.6.9)

@apiapia

apiapia commented Jul 7, 2017

Copy link
Copy Markdown

是真的circular引用了 ! CPU资源竟然多走了20几M!

// FIXME: on PermissionScope -> PermissionScope.swift
using weak var 07/08/2017
weak var weakSelf = self
viewControllerForAlerts = weakSelf

c45a0c5e-2a84-433e-967f-f5001f17e538
5dd41039-4329-4f21-be70-81e97cbc0f36

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants