{"action":"created","issue":{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/699","repository_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage","labels_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/699/labels{/name}","comments_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/699/comments","events_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/699/events","html_url":"https://github.com/litehelpers/Cordova-sqlite-storage/issues/699","id":236535016,"node_id":"MDU6SXNzdWUyMzY1MzUwMTY=","number":699,"title":"iOS Memory Consumption grows with each query","user":{"login":"enayetn","id":4724674,"node_id":"MDQ6VXNlcjQ3MjQ2NzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/4724674?v=4","gravatar_id":"","url":"https://api.github.com/users/enayetn","html_url":"https://github.com/enayetn","followers_url":"https://api.github.com/users/enayetn/followers","following_url":"https://api.github.com/users/enayetn/following{/other_user}","gists_url":"https://api.github.com/users/enayetn/gists{/gist_id}","starred_url":"https://api.github.com/users/enayetn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enayetn/subscriptions","organizations_url":"https://api.github.com/users/enayetn/orgs","repos_url":"https://api.github.com/users/enayetn/repos","events_url":"https://api.github.com/users/enayetn/events{/privacy}","received_events_url":"https://api.github.com/users/enayetn/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-16T16:40:44Z","updated_at":"2018-10-23T15:35:57Z","closed_at":"2017-08-18T05:19:51Z","author_association":"NONE","body":"Hello, \r\n\r\nI am seeing that each transaction with the DB results in a spike in RAM consumption, followed by a persistent bump in memory usage. I have included a memory usage graph below. I have observed this behavior both in this plugin (Cordova-sqlite-storage) as well as the evcore distribution (Cordova-sqlite-evcore-extbuild-free). Would love some fresh eyes on my steps and see if I'm just doing something silly or if this is happening to others. I did not see any sort of API to close my transaction after running one, so I'm at a loss as to why the memory consumption keeps rising with each query. Thanks in advance for any insight anyone can provide. \r\n\r\n![image](https://user-images.githubusercontent.com/4724674/27234751-be703474-5283-11e7-9867-497963ae03dd.png)\r\n_Notice the drop after the 2nd query, this seems to happen after running a new query after leaving the application alone for some time. I have left this running for hours and the memory usage remains steady, and then the first query run after a long idle period will clear some memory (but not back to baseline), so it seems something is tying up the memory and not allowing it to be removed (Excuse my theorizing, I don't have much native experience with this stuff)._\r\n\r\nNote that this is in a brand new, clean Ionic application. I have included replication steps & code below, theoretically this should be usable & reproducible in a plain cordova environment as well. \r\n\r\n**Create DB** \r\n```\r\nvar dbOptions = {\r\n        name : 'mydb.db',\r\n        location : 'default'\r\n      };\r\n     db = window.sqlitePlugin.openDatabase(\r\n        dbOptions\r\n      );\r\n```\r\n\r\n**Create Table**\r\n```\r\ndb.transaction(function(tx){\r\n\ttx.executeSql(\"CREATE TABLE IF NOT EXISTS user_applications (id TEXT PRIMARY KEY NOT NULL,name TEXT,logo BLOB,appfile BLOB)\", null, function(tx,r){console.log(r)})\r\n}, function(e){console.log(e);});\r\n```\r\n\r\n**Insert Dummy 10,000 Rows** - The memory usage is more easily seen with larger SELECT statements\r\n```\r\ndb.transaction(function(tx){\r\n\tfor (var i=0; i<10000; i++) {tx.executeSql(\"INSERT INTO user_applications (id,name,logo,appfile) VALUES (\"+i+\",1,1,1)\", null, function(tx,r){console.log(r)});}\r\n}, function(e){console.log(e);});\r\n```\r\n\r\n**Perform Queries** - Each query run here (tested through both running in console & code) will result in a little spike followed by a persistent bump in memory consumption. This seems to be proportional to the # of rows being selected. \r\n```\r\ndb.transaction(function(tx){\r\n\ttx.executeSql(\"SELECT * FROM user_applications\", null, function(tx,r){console.log(r)})\r\n}, function(e){console.log(e);});\r\n```\r\n\r\nBelow is a gif of me running the last query & observing the memory spike in XCode\r\n\r\n![image](https://i.gyazo.com/ce8acb841b8dd2279fc7a4eb65cad795.gif)\r\n"},"comment":{"url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/comments/432298372","html_url":"https://github.com/litehelpers/Cordova-sqlite-storage/issues/699#issuecomment-432298372","issue_url":"https://api.github.com/repos/litehelpers/Cordova-sqlite-storage/issues/699","id":432298372,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMjI5ODM3Mg==","user":{"login":"dvdpzzt-webmapp","id":42169640,"node_id":"MDQ6VXNlcjQyMTY5NjQw","avatar_url":"https://avatars1.githubusercontent.com/u/42169640?v=4","gravatar_id":"","url":"https://api.github.com/users/dvdpzzt-webmapp","html_url":"https://github.com/dvdpzzt-webmapp","followers_url":"https://api.github.com/users/dvdpzzt-webmapp/followers","following_url":"https://api.github.com/users/dvdpzzt-webmapp/following{/other_user}","gists_url":"https://api.github.com/users/dvdpzzt-webmapp/gists{/gist_id}","starred_url":"https://api.github.com/users/dvdpzzt-webmapp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvdpzzt-webmapp/subscriptions","organizations_url":"https://api.github.com/users/dvdpzzt-webmapp/orgs","repos_url":"https://api.github.com/users/dvdpzzt-webmapp/repos","events_url":"https://api.github.com/users/dvdpzzt-webmapp/events{/privacy}","received_events_url":"https://api.github.com/users/dvdpzzt-webmapp/received_events","type":"User","site_admin":false},"created_at":"2018-10-23T15:35:57Z","updated_at":"2018-10-23T15:35:57Z","author_association":"NONE","body":"@enayetn Did you solve it?"}}
{"actor":{"display_login":"dvdpzzt-webmapp"}}