Memory leak when using HybridWebView.CallJsFunction() ?

Hi,
I am using the XLabs HybridWebView to communicate between a WebView and native code. I ran into an issue that the memory fills up continuously and am currently trying to track down the problem.

Here I am currently wondering how the CallJsFunction of the HybridWebView is supposed to work. From what I can see, it creates a single string consisting of the function name and the parameters and passes this to InjectJavascript() method. I assume this method will somehow inject the JavaScript code into my WebView?

If this is the case, is the injected code cleared at some point? Because I am calling the CallJsFunction quite often with a long (large object in JSON format) parameter. If I understand it correctly, calling the CallJsFunction 100 times will inject 100 JavaScript methods? This would not be good if the JSON object is let's say 1mb, then my webview size would increase by 100 MB?

Would be great if somebody could tell me where I am wrong or what I am supposted to do in this case.

Best regards,
Dominic

Answers

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    You have the source code. Search for what the native renderer does when you call that method and then look up the documentation of that method.
    You didn't say on which platform you currently work, so we cannot do this work for you.

  • dominicdesudominicdesu DEMember

    Hi,
    thanks for your reply.
    I am using UWP as a platform, and it seems like the eval function is called to execute the script. So I guess this is not the reason for the memory leak...

Sign In or Register to comment.