You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Staci Cooper <st...@gmail.com> on 2014/06/20 22:20:12 UTC

network-information memory leak

I found another memory leak in windows phone. This time it involves the
network information plugin.

I found a fix:
https://github.com/stacic/cordova-plugin-network-information/commit/d41118f0da0270d23cd699dc0766d377c9e8922a

But I'm not sure I understand why it works. In addition to unsubscribing
from some event handlers, it involves the getConnectionInfo function in
NetworkStatus.js, which takes a string parameter called 'empty' that it
does nothing with. If I get rid of that parameter the leak disappears.

Does anybody know why it was there in the first place? I didn't see any
problems after deleting it, but it seems odd.

Re: network-information memory leak

Posted by Staci Cooper <st...@gmail.com>.
The leak happens when you start the application on a native page and then
navigate back and forth between it and the hybrid page. It was reported by
an IBM customer and I was verifying its existence and the fix with Visual
Studio's memory profiler.

If you add the network-information plugin, when navigating back and forth
between pages, it keeps creating new instances of MainPage and they are
never garbage collected. With the commit I linked to, the pages get garbage
collected. If I add the string empty back, I see the leak again, but I
don't understand why.




On Fri, Jun 20, 2014 at 4:28 PM, Jesse <pu...@gmail.com> wrote:

> What is leaked?
> How are you proving that there is a leak, and it is indeed fixed?
>
> All js callable cordova commands are backed by c# subclasses of BaseCommand
> and their methods all have the same signature:
>
> public void callableMethod(string);
>
>
>
>
> @purplecabbage
> risingj.com
>
>
> On Fri, Jun 20, 2014 at 1:20 PM, Staci Cooper <st...@gmail.com> wrote:
>
> > I found another memory leak in windows phone. This time it involves the
> > network information plugin.
> >
> > I found a fix:
> >
> >
> https://github.com/stacic/cordova-plugin-network-information/commit/d41118f0da0270d23cd699dc0766d377c9e8922a
> >
> > But I'm not sure I understand why it works. In addition to unsubscribing
> > from some event handlers, it involves the getConnectionInfo function in
> > NetworkStatus.js, which takes a string parameter called 'empty' that it
> > does nothing with. If I get rid of that parameter the leak disappears.
> >
> > Does anybody know why it was there in the first place? I didn't see any
> > problems after deleting it, but it seems odd.
> >
>

Re: network-information memory leak

Posted by Jesse <pu...@gmail.com>.
What is leaked?
How are you proving that there is a leak, and it is indeed fixed?

All js callable cordova commands are backed by c# subclasses of BaseCommand
and their methods all have the same signature:

public void callableMethod(string);




@purplecabbage
risingj.com


On Fri, Jun 20, 2014 at 1:20 PM, Staci Cooper <st...@gmail.com> wrote:

> I found another memory leak in windows phone. This time it involves the
> network information plugin.
>
> I found a fix:
>
> https://github.com/stacic/cordova-plugin-network-information/commit/d41118f0da0270d23cd699dc0766d377c9e8922a
>
> But I'm not sure I understand why it works. In addition to unsubscribing
> from some event handlers, it involves the getConnectionInfo function in
> NetworkStatus.js, which takes a string parameter called 'empty' that it
> does nothing with. If I get rid of that parameter the leak disappears.
>
> Does anybody know why it was there in the first place? I didn't see any
> problems after deleting it, but it seems odd.
>