{"action":"created","issue":{"url":"https://api.github.com/repos/tessel/tessel-av/issues/12","repository_url":"https://api.github.com/repos/tessel/tessel-av","labels_url":"https://api.github.com/repos/tessel/tessel-av/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/tessel/tessel-av/issues/12/comments","events_url":"https://api.github.com/repos/tessel/tessel-av/issues/12/events","html_url":"https://github.com/tessel/tessel-av/issues/12","id":156074814,"number":12,"title":"Memory leak when streaming from camera","user":{"login":"jwlawrence","id":488888,"avatar_url":"https://avatars.githubusercontent.com/u/488888?v=3","gravatar_id":"","url":"https://api.github.com/users/jwlawrence","html_url":"https://github.com/jwlawrence","followers_url":"https://api.github.com/users/jwlawrence/followers","following_url":"https://api.github.com/users/jwlawrence/following{/other_user}","gists_url":"https://api.github.com/users/jwlawrence/gists{/gist_id}","starred_url":"https://api.github.com/users/jwlawrence/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jwlawrence/subscriptions","organizations_url":"https://api.github.com/users/jwlawrence/orgs","repos_url":"https://api.github.com/users/jwlawrence/repos","events_url":"https://api.github.com/users/jwlawrence/events{/privacy}","received_events_url":"https://api.github.com/users/jwlawrence/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-21T00:48:55Z","updated_at":"2016-05-25T21:11:19Z","closed_at":null,"body":"When using `camera.stream()` I noticed that after a variable amount of time (usually 15 to 30 seconds) my Tessel 2 would stop responding. I added a log with `process.memoryUsage()` in my `camera.on('data')` event and the rss value steadily rose over time until the app crashed. I'm going to read through the tessel-av code and see if I can figure out what might be causing it, but it would be nice to get some help from someone who's more familiar with the library."},"comment":{"url":"https://api.github.com/repos/tessel/tessel-av/issues/comments/221708853","html_url":"https://github.com/tessel/tessel-av/issues/12#issuecomment-221708853","issue_url":"https://api.github.com/repos/tessel/tessel-av/issues/12","id":221708853,"user":{"login":"rwaldron","id":27985,"avatar_url":"https://avatars.githubusercontent.com/u/27985?v=3","gravatar_id":"","url":"https://api.github.com/users/rwaldron","html_url":"https://github.com/rwaldron","followers_url":"https://api.github.com/users/rwaldron/followers","following_url":"https://api.github.com/users/rwaldron/following{/other_user}","gists_url":"https://api.github.com/users/rwaldron/gists{/gist_id}","starred_url":"https://api.github.com/users/rwaldron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwaldron/subscriptions","organizations_url":"https://api.github.com/users/rwaldron/orgs","repos_url":"https://api.github.com/users/rwaldron/repos","events_url":"https://api.github.com/users/rwaldron/events{/privacy}","received_events_url":"https://api.github.com/users/rwaldron/received_events","type":"User","site_admin":false},"created_at":"2016-05-25T21:11:19Z","updated_at":"2016-05-25T21:11:19Z","body":"I was able to reproduce this. By setting an explicit highWaterMark, I was able to get steady memory usage:\r\n\r\n```\r\n+ 0.23 (total: 21.22)\r\n+ 0.13 (total: 21.35)\r\n+ 0.07 (total: 21.42)\r\n+ 0.18 (total: 21.60)\r\n+ 0.08 (total: 21.68)\r\n+ 0.07 (total: 21.75)\r\n+ 0.33 (total: 22.08)\r\n- 0.27 (total: 21.81)\r\n+ 0.16 (total: 21.97)\r\n+ 0.11 (total: 22.08)\r\n+ 0.23 (total: 22.31)\r\n+ 0.24 (total: 22.55)\r\n+ 0.38 (total: 22.93)\r\n- 0.59 (total: 22.34)\r\n+ 0.07 (total: 22.41)\r\n+ 0.1 (total: 22.51)\r\n+ 0.11 (total: 22.62)\r\n+ 0.11 (total: 22.73)\r\n+ 0.11 (total: 22.84)\r\n+ 0.15 (total: 22.99)\r\n- 0.49 (total: 22.50)\r\n+ 0.14 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.13 (total: 22.88)\r\n+ 0.11 (total: 22.99)\r\n- 0.64 (total: 22.35)\r\n+ 0.11 (total: 22.46)\r\n+ 0.11 (total: 22.57)\r\n+ 0.1 (total: 22.67)\r\n+ 0.11 (total: 22.78)\r\n+ 0.11 (total: 22.89)\r\n+ 0.11 (total: 23.00)\r\n+ 0.11 (total: 23.11)\r\n- 0.77 (total: 22.34)\r\n+ 0.11 (total: 22.45)\r\n+ 0.12 (total: 22.57)\r\n+ 0.11 (total: 22.68)\r\n+ 0.11 (total: 22.79)\r\n+ 0.12 (total: 22.91)\r\n+ 0.11 (total: 23.02)\r\n+ 0.12 (total: 23.14)\r\n- 0.69 (total: 22.45)\r\n+ 0.11 (total: 22.56)\r\n+ 0.12 (total: 22.68)\r\n+ 0.11 (total: 22.79)\r\n+ 0.11 (total: 22.90)\r\n+ 0.12 (total: 23.02)\r\n+ 0.11 (total: 23.13)\r\n- 0.76 (total: 22.37)\r\n+ 0.11 (total: 22.48)\r\n+ 0.12 (total: 22.60)\r\n+ 0.11 (total: 22.71)\r\n+ 0.11 (total: 22.82)\r\n+ 0.12 (total: 22.94)\r\n+ 0.11 (total: 23.05)\r\n+ 0.15 (total: 23.20)\r\n+ 0.05 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n  0 (total: 23.25)\r\n- 0.21 (total: 23.04)\r\n- 0.35 (total: 22.69)\r\n+ 0.01 (total: 22.70)\r\n  0 (total: 22.70)\r\n+ 0.11 (total: 22.81)\r\n+ 0.14 (total: 22.95)\r\n+ 0.08 (total: 23.03)\r\n+ 0.21 (total: 23.24)\r\n+ 0.13 (total: 23.37)\r\n+ 0.11 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n  0 (total: 23.48)\r\n- 0.17 (total: 23.31)\r\n  0 (total: 23.31)\r\n  0 (total: 23.31)\r\n  0 (total: 23.31)\r\n  0 (total: 23.31)\r\n  0 (total: 23.31)\r\n  0 (total: 23.31)\r\n+ 0.05 (total: 23.36)\r\n+ 0.11 (total: 23.47)\r\n+ 0.24 (total: 23.71)\r\n+ 0.24 (total: 23.95)\r\n+ 0.24 (total: 24.19)\r\n+ 0.24 (total: 24.43)\r\n+ 0.24 (total: 24.67)\r\n+ 0.24 (total: 24.91)\r\n+ 0.24 (total: 25.15)\r\n+ 0.24 (total: 25.39)\r\n- 0.05 (total: 25.34)\r\n- 0.99 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n  0 (total: 24.35)\r\n- 2.16 (total: 22.19)\r\n+ 0.11 (total: 22.30)\r\n+ 0.11 (total: 22.41)\r\n+ 0.1 (total: 22.51)\r\n+ 0.11 (total: 22.62)\r\n+ 0.11 (total: 22.73)\r\n+ 0.1 (total: 22.83)\r\n+ 0.11 (total: 22.94)\r\n+ 0.2 (total: 23.14)\r\n- 0.85 (total: 22.29)\r\n+ 0.11 (total: 22.40)\r\n+ 0.11 (total: 22.51)\r\n+ 0.1 (total: 22.61)\r\n+ 0.11 (total: 22.72)\r\n+ 0.1 (total: 22.82)\r\n+ 0.11 (total: 22.93)\r\n+ 0.11 (total: 23.04)\r\n+ 0.1 (total: 23.14)\r\n- 0.84 (total: 22.30)\r\n+ 0.1 (total: 22.40)\r\n+ 0.11 (total: 22.51)\r\n+ 0.11 (total: 22.62)\r\n+ 0.1 (total: 22.72)\r\n+ 0.11 (total: 22.83)\r\n+ 0.11 (total: 22.94)\r\n+ 0.1 (total: 23.04)\r\n+ 0.11 (total: 23.15)\r\n- 0.83 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.11 (total: 22.54)\r\n+ 0.1 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.1 (total: 22.96)\r\n+ 0.11 (total: 23.07)\r\n+ 0.11 (total: 23.18)\r\n- 0.86 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.11 (total: 22.54)\r\n+ 0.1 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.1 (total: 22.96)\r\n+ 0.11 (total: 23.07)\r\n+ 0.1 (total: 23.17)\r\n- 0.85 (total: 22.32)\r\n+ 0.1 (total: 22.42)\r\n+ 0.11 (total: 22.53)\r\n+ 0.11 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.12 (total: 22.87)\r\n+ 0.11 (total: 22.98)\r\n+ 0.11 (total: 23.09)\r\n- 0.77 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.12 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.12 (total: 22.78)\r\n+ 0.11 (total: 22.89)\r\n+ 0.11 (total: 23.00)\r\n+ 0.11 (total: 23.11)\r\n- 0.77 (total: 22.34)\r\n+ 0.11 (total: 22.45)\r\n+ 0.1 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.11 (total: 22.77)\r\n+ 0.11 (total: 22.88)\r\n+ 0.11 (total: 22.99)\r\n+ 0.11 (total: 23.10)\r\n- 0.78 (total: 22.32)\r\n+ 0.1 (total: 22.42)\r\n+ 0.11 (total: 22.53)\r\n+ 0.11 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.1 (total: 22.96)\r\n+ 0.11 (total: 23.07)\r\n- 0.76 (total: 22.31)\r\n+ 0.11 (total: 22.42)\r\n+ 0.12 (total: 22.54)\r\n+ 0.11 (total: 22.65)\r\n+ 0.11 (total: 22.76)\r\n+ 0.09 (total: 22.85)\r\n+ 0.1 (total: 22.95)\r\n+ 0.09 (total: 23.04)\r\n+ 0.09 (total: 23.13)\r\n- 0.82 (total: 22.31)\r\n+ 0.09 (total: 22.40)\r\n+ 0.1 (total: 22.50)\r\n+ 0.11 (total: 22.61)\r\n+ 0.11 (total: 22.72)\r\n+ 0.11 (total: 22.83)\r\n+ 0.11 (total: 22.94)\r\n+ 0.11 (total: 23.05)\r\n+ 0.11 (total: 23.16)\r\n- 0.82 (total: 22.34)\r\n+ 0.11 (total: 22.45)\r\n+ 0.11 (total: 22.56)\r\n+ 0.1 (total: 22.66)\r\n+ 0.11 (total: 22.77)\r\n+ 0.11 (total: 22.88)\r\n+ 0.1 (total: 22.98)\r\n+ 0.11 (total: 23.09)\r\n+ 0.1 (total: 23.19)\r\n- 0.85 (total: 22.34)\r\n+ 0.1 (total: 22.44)\r\n+ 0.11 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.1 (total: 22.76)\r\n+ 0.11 (total: 22.87)\r\n+ 0.11 (total: 22.98)\r\n+ 0.11 (total: 23.09)\r\n+ 0.11 (total: 23.20)\r\n- 0.86 (total: 22.34)\r\n+ 0.11 (total: 22.45)\r\n+ 0.1 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.11 (total: 22.77)\r\n+ 0.11 (total: 22.88)\r\n+ 0.1 (total: 22.98)\r\n+ 0.11 (total: 23.09)\r\n+ 0.11 (total: 23.20)\r\n- 0.85 (total: 22.35)\r\n+ 0.1 (total: 22.45)\r\n+ 0.1 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.11 (total: 22.77)\r\n+ 0.11 (total: 22.88)\r\n+ 0.11 (total: 22.99)\r\n+ 0.11 (total: 23.10)\r\n- 1.08 (total: 22.02)\r\n+ 0.11 (total: 22.13)\r\n+ 0.12 (total: 22.25)\r\n+ 0.11 (total: 22.36)\r\n+ 0.11 (total: 22.47)\r\n+ 0.11 (total: 22.58)\r\n+ 0.17 (total: 22.75)\r\n+ 0.25 (total: 23.00)\r\n- 0.75 (total: 22.25)\r\n+ 0.12 (total: 22.37)\r\n+ 0.11 (total: 22.48)\r\n+ 0.11 (total: 22.59)\r\n+ 0.11 (total: 22.70)\r\n+ 0.12 (total: 22.82)\r\n+ 0.11 (total: 22.93)\r\n+ 0.11 (total: 23.04)\r\n- 0.79 (total: 22.25)\r\n+ 0.11 (total: 22.36)\r\n+ 0.12 (total: 22.48)\r\n+ 0.11 (total: 22.59)\r\n+ 0.11 (total: 22.70)\r\n+ 0.1 (total: 22.80)\r\n+ 0.09 (total: 22.89)\r\n+ 0.11 (total: 23.00)\r\n+ 0.18 (total: 23.18)\r\n- 0.85 (total: 22.33)\r\n+ 0.11 (total: 22.44)\r\n+ 0.11 (total: 22.55)\r\n+ 0.11 (total: 22.66)\r\n+ 0.11 (total: 22.77)\r\n+ 0.1 (total: 22.87)\r\n+ 0.11 (total: 22.98)\r\n+ 0.11 (total: 23.09)\r\n- 1.24 (total: 21.85)\r\n+ 0.11 (total: 21.96)\r\n+ 0.11 (total: 22.07)\r\n+ 0.12 (total: 22.19)\r\n+ 0.11 (total: 22.30)\r\n+ 0.21 (total: 22.51)\r\n+ 0.26 (total: 22.77)\r\n+ 0.26 (total: 23.03)\r\n- 0.74 (total: 22.29)\r\n+ 0.11 (total: 22.40)\r\n+ 0.12 (total: 22.52)\r\n+ 0.11 (total: 22.63)\r\n+ 0.11 (total: 22.74)\r\n+ 0.12 (total: 22.86)\r\n+ 0.11 (total: 22.97)\r\n+ 0.12 (total: 23.09)\r\n- 0.8 (total: 22.29)\r\n+ 0.12 (total: 22.41)\r\n+ 0.11 (total: 22.52)\r\n+ 0.11 (total: 22.63)\r\n+ 0.12 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.11 (total: 22.97)\r\n+ 0.12 (total: 23.09)\r\n- 1.11 (total: 21.98)\r\n+ 0.11 (total: 22.09)\r\n+ 0.12 (total: 22.21)\r\n+ 0.1 (total: 22.31)\r\n+ 0.11 (total: 22.42)\r\n+ 0.11 (total: 22.53)\r\n+ 0.19 (total: 22.72)\r\n+ 0.24 (total: 22.96)\r\n- 0.75 (total: 22.21)\r\n+ 0.11 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.11 (total: 22.54)\r\n+ 0.1 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.12 (total: 22.87)\r\n+ 0.11 (total: 22.98)\r\n- 1.04 (total: 21.94)\r\n+ 0.11 (total: 22.05)\r\n+ 0.09 (total: 22.14)\r\n+ 0.1 (total: 22.24)\r\n+ 0.11 (total: 22.35)\r\n+ 0.11 (total: 22.46)\r\n+ 0.18 (total: 22.64)\r\n+ 0.24 (total: 22.88)\r\n+ 0.24 (total: 23.12)\r\n- 0.8 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.11 (total: 22.54)\r\n+ 0.1 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.11 (total: 22.97)\r\n+ 0.11 (total: 23.08)\r\n- 0.78 (total: 22.30)\r\n+ 0.11 (total: 22.41)\r\n+ 0.11 (total: 22.52)\r\n+ 0.1 (total: 22.62)\r\n+ 0.1 (total: 22.72)\r\n+ 0.1 (total: 22.82)\r\n+ 0.11 (total: 22.93)\r\n+ 0.11 (total: 23.04)\r\n+ 0.1 (total: 23.14)\r\n- 0.83 (total: 22.31)\r\n+ 0.11 (total: 22.42)\r\n+ 0.11 (total: 22.53)\r\n+ 0.11 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.11 (total: 22.97)\r\n+ 0.11 (total: 23.08)\r\n- 1.11 (total: 21.97)\r\n+ 0.11 (total: 22.08)\r\n+ 0.11 (total: 22.19)\r\n+ 0.11 (total: 22.30)\r\n+ 0.11 (total: 22.41)\r\n+ 0.1 (total: 22.51)\r\n+ 0.19 (total: 22.70)\r\n+ 0.24 (total: 22.94)\r\n- 0.73 (total: 22.21)\r\n+ 0.11 (total: 22.32)\r\n+ 0.11 (total: 22.43)\r\n+ 0.11 (total: 22.54)\r\n+ 0.1 (total: 22.64)\r\n+ 0.11 (total: 22.75)\r\n+ 0.11 (total: 22.86)\r\n+ 0.1 (total: 22.96)\r\n+ 0.19 (total: 23.15)\r\n- 0.8 (total: 22.35)\r\n+ 0.1 (total: 22.45)\r\n+ 0.1 (total: 22.55)\r\n+ 0.1 (total: 22.65)\r\n+ 0.1 (total: 22.75)\r\n+ 0.1 (total: 22.85)\r\n+ 0.1 (total: 22.95)\r\n+ 0.1 (total: 23.05)\r\n+ 0.1 (total: 23.15)\r\n- 0.82 (total: 22.33)\r\n+ 0.11 (total: 22.44)\r\n+ 0.1 (total: 22.54)\r\n+ 0.11 (total: 22.65)\r\n+ 0.11 (total: 22.76)\r\n+ 0.11 (total: 22.87)\r\n+ 0.11 (total: 22.98)\r\n+ 0.12 (total: 23.10)\r\n- 0.74 (total: 22.36)\r\n+ 0.11 (total: 22.47)\r\n+ 0.11 (total: 22.58)\r\n+ 0.11 (total: 22.69)\r\n+ 0.11 (total: 22.80)\r\n+ 0.12 (total: 22.92)\r\n+ 0.12 (total: 23.04)\r\n+ 0.11 (total: 23.15)\r\n- 0.79 (total: 22.36)\r\n+ 0.11 (total: 22.47)\r\n+ 0.11 (total: 22.58)\r\n+ 0.12 (total: 22.70)\r\n+ 0.11 (total: 22.81)\r\n+ 0.1 (total: 22.91)\r\n+ 0.12 (total: 23.03)\r\n+ 0.11 (total: 23.14)\r\n- 0.78 (total: 22.36)\r\n+ 0.11 (total: 22.47)\r\n+ 0.1 (total: 22.57)\r\n+ 0.1 (total: 22.67)\r\n+ 0.12 (total: 22.79)\r\n+ 0.1 (total: 22.89)\r\n+ 0.11 (total: 23.00)\r\n+ 0.11 (total: 23.11)\r\n- 1.41 (total: 21.70)\r\n+ 0.1 (total: 21.80)\r\n+ 0.12 (total: 21.92)\r\n+ 0.11 (total: 22.03)\r\n+ 0.19 (total: 22.22)\r\n+ 0.26 (total: 22.48)\r\n+ 0.25 (total: 22.73)\r\n+ 0.25 (total: 22.98)\r\n- 0.72 (total: 22.26)\r\n+ 0.11 (total: 22.37)\r\n+ 0.11 (total: 22.48)\r\n+ 0.1 (total: 22.58)\r\n+ 0.11 (total: 22.69)\r\n+ 0.11 (total: 22.80)\r\n+ 0.11 (total: 22.91)\r\n+ 0.11 (total: 23.02)\r\n- 0.76 (total: 22.26)\r\n+ 0.11 (total: 22.37)\r\n+ 0.11 (total: 22.48)\r\n+ 0.11 (total: 22.59)\r\n+ 0.11 (total: 22.70)\r\n+ 0.1 (total: 22.80)\r\n+ 0.11 (total: 22.91)\r\n+ 0.11 (total: 23.02)\r\n- 1.06 (total: 21.96)\r\n+ 0.11 (total: 22.07)\r\n+ 0.11 (total: 22.18)\r\n+ 0.11 (total: 22.29)\r\n+ 0.1 (total: 22.39)\r\n+ 0.11 (total: 22.50)\r\n+ 0.19 (total: 22.69)\r\n+ 0.24 (total: 22.93)\r\n- 0.72 (total: 22.21)\r\n+ 0.11 (total: 22.32)\r\n+ 0.1 (total: 22.42)\r\n+ 0.1 (total: 22.52)\r\n+ 0.11 (total: 22.63)\r\n+ 0.11 (total: 22.74)\r\n+ 0.1 (total: 22.84)\r\n+ 0.11 (total: 22.95)\r\n+ 0.18 (total: 23.13)\r\n- 0.81 (total: 22.32)\r\n```\r\n\r\nHere's the camera code: \r\n\r\n```js\r\ncamera.on('data', (data) => {\r\n  var now = Date.now();\r\n  var usage = (process.memoryUsage().rss / (1024 * 1024)).toFixed(2);\r\n  var what = '';\r\n\r\n  if (!rss) {\r\n    rss = usage;\r\n  } else {\r\n    var diff = (usage - rss).toFixed(2);\r\n\r\n    if (usage > rss) {\r\n      what = '+';\r\n    } else {\r\n      if (usage === rss) {\r\n        what = ' ';\r\n      } else {\r\n        what = '-';\r\n      }\r\n    }\r\n  }\r\n  console.log(`${what} ${Math.abs(diff)} (total: ${((+rss) + (+diff)).toFixed(2)})`);\r\n\r\n  rss = usage;\r\n});\r\n\r\n``` "}}
{"actor":{"display_login":"rwaldron"}}