{"action":"created","issue":{"url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/19","repository_url":"https://api.github.com/repos/Cloud-Automation/node-modbus","labels_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/19/comments","events_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/19/events","html_url":"https://github.com/Cloud-Automation/node-modbus/issues/19","id":135239517,"number":19,"title":"Memory leaks","user":{"login":"bladerunner2020","id":13632647,"avatar_url":"https://avatars.githubusercontent.com/u/13632647?v=3","gravatar_id":"","url":"https://api.github.com/users/bladerunner2020","html_url":"https://github.com/bladerunner2020","followers_url":"https://api.github.com/users/bladerunner2020/followers","following_url":"https://api.github.com/users/bladerunner2020/following{/other_user}","gists_url":"https://api.github.com/users/bladerunner2020/gists{/gist_id}","starred_url":"https://api.github.com/users/bladerunner2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bladerunner2020/subscriptions","organizations_url":"https://api.github.com/users/bladerunner2020/orgs","repos_url":"https://api.github.com/users/bladerunner2020/repos","events_url":"https://api.github.com/users/bladerunner2020/events{/privacy}","received_events_url":"https://api.github.com/users/bladerunner2020/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-02-21T18:29:15Z","updated_at":"2016-02-28T17:31:34Z","closed_at":"2016-02-28T17:31:34Z","body":"It seems that there is a memory leak in jsmodbus module.\r\nI have 16 modbus devices connected via TCP. Each device has 8 registers.\r\nI wrote a simple test that reads all registers of all devices every 5 seconds.\r\nFor 40 minutes the heap grew from 36 to 436 Mb. See the picture attached.\r\n\r\nTest application is attached.\r\n\r\n[test_modubs.txt](https://github.com/Cloud-Automation/node-modbus/files/139783/test_modubs.txt)\r\n\r\n<img width=\"1198\" alt=\"screen shot 2016-02-21 at 20 33 49\" src=\"https://cloud.githubusercontent.com/assets/13632647/13204420/b28c336a-d8e0-11e5-85af-5dbfa1ac5427.png\">\r\n"},"comment":{"url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/comments/189911631","html_url":"https://github.com/Cloud-Automation/node-modbus/issues/19#issuecomment-189911631","issue_url":"https://api.github.com/repos/Cloud-Automation/node-modbus/issues/19","id":189911631,"user":{"login":"BauchBeinePoe","id":962108,"avatar_url":"https://avatars.githubusercontent.com/u/962108?v=3","gravatar_id":"","url":"https://api.github.com/users/BauchBeinePoe","html_url":"https://github.com/BauchBeinePoe","followers_url":"https://api.github.com/users/BauchBeinePoe/followers","following_url":"https://api.github.com/users/BauchBeinePoe/following{/other_user}","gists_url":"https://api.github.com/users/BauchBeinePoe/gists{/gist_id}","starred_url":"https://api.github.com/users/BauchBeinePoe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BauchBeinePoe/subscriptions","organizations_url":"https://api.github.com/users/BauchBeinePoe/orgs","repos_url":"https://api.github.com/users/BauchBeinePoe/repos","events_url":"https://api.github.com/users/BauchBeinePoe/events{/privacy}","received_events_url":"https://api.github.com/users/BauchBeinePoe/received_events","type":"User","site_admin":false},"created_at":"2016-02-28T17:31:34Z","updated_at":"2016-02-28T17:31:34Z","body":"I would say that, since you have read the single registers separatly the 1000 ms cycle was to long. I mean the 16 modbus requests took longer than 1000ms. Try measuring how long a modbus request takes and I bet the eight or 16 requests tooks longer than 1s.\r\n\r\nThe problem here is that, as i assume, some request haven't been finished by the time the next interval function is called, the heap grows because of unfinished modbus requests and every seconds there will be some more requests that haven't been finished."}}