JavascriptBridge icon indicating copy to clipboard operation
JavascriptBridge copied to clipboard

WKWebView Not getting dealloc'ed

Open saru2020 opened this issue 6 years ago • 3 comments

Hi,

A great library for logging purposes. There is one issue where if the logs are enabled then it holds onto the webview's instance which leads to memory leaks.

saru2020 avatar May 01 '20 09:05 saru2020

Hi, Very thanks to use the library. And i had add a class named "SKWebView" to test whether will leads to memory leaks . But when i leave the "ExampleWKWebViewController" and the function

- (void)dealloc {
    NSLog(@"SKWebView dealloc ");
}

in "SKWebView" was called.

I had pushed the last code, and you can open finder "TestPod" to have a try。@saru2020

housenkui avatar May 02 '20 05:05 housenkui

Its a great library and very much useful, thanks for creating it. Thanks for the sample. Yes, the dealloc of the controller is called when you leave it. Please check the same flow in the Instruments/Leaks/Allocations app and you’ll see that only the WKWebView and its interlinked objects alone aren’t getting dealloc’ed. I didn’t look into your implementation but something’s holding onto the WKWebView’s instance specifically. Note: I didn’t try your sample but saying this by testing it from my own project and only after removing the entire library, I saw the webview’s instances getting released, probably, there is something wrong with the run time apis working with the webview apis.

Thanks! Saravanan Sent from my iPhone(Please excuse any typos)

On 02-May-2020, at 11:19 AM, Daves_Hou [email protected] wrote:

 Hi, Very thanks to use the library. And i had add a class named "SKWebView" to test whether will leads to memory leaks . But when i leave the "ExampleWKWebViewController" and the function

  • (void)dealloc { NSLog(@"SKWebView dealloc "); } in "SKWebView" was called.

I had pushed the last code, and you can open finder "TestPod" to have a try。@saru2020

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

saru2020 avatar May 02 '20 06:05 saru2020

Dear friend,It‘s my pleasure. How wonderful of the world in github! SKWebview is the Subclass of WKWebview. The dealloc of the SKWebview is called when you leave secondViewcontroller. And i use instruments/Leaks/Allocations test for "TestPod" (DEMO) in the library. The video url is : https://www.youtube.com/watch?v=mngmT-2xrgk I did not found something wrong?

Dear friend, are you ok in your project?

housenkui avatar May 02 '20 16:05 housenkui