{"action":"created","issue":{"url":"https://api.github.com/repos/puuu/ESPiLight/issues/8","repository_url":"https://api.github.com/repos/puuu/ESPiLight","labels_url":"https://api.github.com/repos/puuu/ESPiLight/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/puuu/ESPiLight/issues/8/comments","events_url":"https://api.github.com/repos/puuu/ESPiLight/issues/8/events","html_url":"https://github.com/puuu/ESPiLight/issues/8","id":233445282,"number":8,"title":"memory leak","user":{"login":"gschintgen","id":11065156,"avatar_url":"https://avatars1.githubusercontent.com/u/11065156?v=3","gravatar_id":"","url":"https://api.github.com/users/gschintgen","html_url":"https://github.com/gschintgen","followers_url":"https://api.github.com/users/gschintgen/followers","following_url":"https://api.github.com/users/gschintgen/following{/other_user}","gists_url":"https://api.github.com/users/gschintgen/gists{/gist_id}","starred_url":"https://api.github.com/users/gschintgen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gschintgen/subscriptions","organizations_url":"https://api.github.com/users/gschintgen/orgs","repos_url":"https://api.github.com/users/gschintgen/repos","events_url":"https://api.github.com/users/gschintgen/events{/privacy}","received_events_url":"https://api.github.com/users/gschintgen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-04T16:51:54Z","updated_at":"2017-06-05T03:08:17Z","closed_at":null,"body":"Hi,\r\nI think there may be a memory leak in EsPiLight. (I'm not an expert developer, so it could well be some kind of user error...)\r\nHere's a minimal code sample illustrating the problem I've encountered:\r\n\r\n```\r\n#include <ESPiLight.h>\r\n#define TRANSMITTER_PIN D4\r\nESPiLight rf(TRANSMITTER_PIN);\r\n\r\n#define runAtMostEvery(t) for (static uint16_t _lasttime;\\\r\n      (uint16_t)((uint16_t)millis() - _lasttime) >= (t);\\\r\n      _lasttime = (uint16_t)millis())\r\n\r\nconst char strOn[]  = \"{\\\"systemcode\\\":11,\\\"unitcode\\\":1,\\\"on\\\":1}\";\r\n\r\nvoid setup() {\r\n  Serial.begin(115200);\r\n  Serial.println(\"Booting\");\r\n}\r\n\r\nvoid loop() {\r\n  runAtMostEvery(1000) {\r\n    Serial.printf(\"loop heap size: %u\\n\", ESP.getFreeHeap());\r\n    rf.send(\"elro_800_switch\", strOn);\r\n  }\r\n}\r\n\r\n```\r\nAnd here's the corresponding output:\r\n```\r\nloop heap size: 27336\r\npiLightCreatePulseTrain: protocol: elro_800_switch create Code succeded.\r\nloop heap size: 27088\r\npiLightCreatePulseTrain: protocol: elro_800_switch create Code succeded.\r\nloop heap size: 26840\r\npiLightCreatePulseTrain: protocol: elro_800_switch create Code succeded.\r\nloop heap size: 26592\r\n```\r\nThe free heap size is decreasing until the microcontroller crashes.\r\n\r\nIn my case it's a Wemos D1 Mini. I'm using Atom/PlatformIO."},"comment":{"url":"https://api.github.com/repos/puuu/ESPiLight/issues/comments/306093039","html_url":"https://github.com/puuu/ESPiLight/issues/8#issuecomment-306093039","issue_url":"https://api.github.com/repos/puuu/ESPiLight/issues/8","id":306093039,"user":{"login":"puuu","id":19514939,"avatar_url":"https://avatars0.githubusercontent.com/u/19514939?v=3","gravatar_id":"","url":"https://api.github.com/users/puuu","html_url":"https://github.com/puuu","followers_url":"https://api.github.com/users/puuu/followers","following_url":"https://api.github.com/users/puuu/following{/other_user}","gists_url":"https://api.github.com/users/puuu/gists{/gist_id}","starred_url":"https://api.github.com/users/puuu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puuu/subscriptions","organizations_url":"https://api.github.com/users/puuu/orgs","repos_url":"https://api.github.com/users/puuu/repos","events_url":"https://api.github.com/users/puuu/events{/privacy}","received_events_url":"https://api.github.com/users/puuu/received_events","type":"User","site_admin":false},"created_at":"2017-06-05T03:08:17Z","updated_at":"2017-06-05T03:08:17Z","body":"Thanks, good catch!\r\n\r\nThe minimal code sample was very helpful.\r\n\r\nThe bug is fixed in c7247d86abf80957a151a7a976e5b4dc74aa17c8 .\r\n\r\nI will prepare a new release."}}
{"actor":{"display_login":"puuu"}}