Memory leak while talking to SQL Lite (iOS)

Hi.

I have a fairly advanced app built with cordova/ionic. We have a big database and do a lot of requests to it. cordova-sqlite-ext plugin is being used to work with the database.

This has started as an issue with app showing white screen and going back to home screen after a long session working with it. iOS only. Appeared that it is a memory leak.
From outside - it looks like just opening/closing specific screen/view it just takes more and more memory. We need to do around 50 such operations (with many other operations while on that screen) to see this.
Safari Web Inspector shows it as Page (yellow) category memory is growing.

That view mentioned above - it does a lot of work and reads significant amount of data in multiple requests to the database.
I suspect that memory leak is happening because of scripts posted by iOS to webkit while sending back a response from native SQLLite to JS. That is something like

cordova.require('cordova/exec').nativeCallback(...) posted by webKit.evaluateJavaScript.

Looks like those scripts, usually - pretty small, are never removed by garbage collector.

In some cases - we are getting 1-2-3 MBs from the database at once. And those request are repeated many times. Plus a lot of smaller requests. Isolated code doing just a requests to database - it shows similar behavior. 200-400-600 requests, even those that just return “nothing” create a memory leak.

Few questions here:

  1. Does my understanding look correct? Maybe someone have seen this before.
  2. Any ideas for how to fix that? We will obviously try to reduce amount of data we read from the database, but this looks like an issue that just can’t be resolved if we can’t remove those scripts from webkit’s memory. WIth smaller amounts of data take from the database we just need more time, more requests, to get all memory taken.

Cordova, ionic, webview, sqllite-ext, angular - all of that is latest or nearly latest. But if my understanding is correct - it will be irrelevant as this evaluateJavaScript looks to be a standard way for cordova’s native code to talk to JS.

Any help is appreciated, thanks!