Memory issue?
Closed this issue · 8 comments
For some reason this app uses lots of memory ( 20mb+ ) with only 2 devices paired.
As your can see here: the app grows overnight in usage.
Don't know where the issue lies. Maybe it should use different libraries, but no real clue where the issue lies. Also no experience in memory profiling a homey app / nodejs module.
I also have no experience in profiling but with https://developer.athom.com/tools/app-profiling you can get a nice idea on how the memory usage develops over time. That's what i did when working on domoticz, darksky and other apps.
Run the app, go to that page and select the app. Start working with it and let it run for a couple of minutes. You want to see a 'sharkfin' pattern. So memory goes up and then after a while it drops because the garbage collector kicks in. This way I could determin some leaks in my own code. For other libraries it's a bit harder because you can't see them in this overview ofcourse but atleast you can pinpoint on what event, in your app, the memory is used.
No update so far as i have other priorities to tend to atm. I'd guess it has to do with some modules i include to poll the API, but that would require me to do intensive digging into them or replace them for something else.
If someone is willing to do the work in the meantime, i'd be happy to review and/or update the app in homey.
If you are interested. I'm currently working on my own implementation of the Ubiquity api. Can you tell me which events you are interested in and which capabilities of the controller api/software? This way I can add them and maybe we can replace your backend with that implementation? I'm trying to make it as small as possible :)
Great idea!
This are the interactions gathered from code:
Events:
- ctrl.connect
- ctrl.disconnect
- wu.connected
- wu.disconnected
Interval based url fetching:
Fetching all known clients (for pairing):
/stat/alluser -> https://github.com/mnederlof/com.ubnt.unifi/blob/sdk-v2/drivers/wifi-client/driver.js#L571
Updating accesspoints regularly:
/stat/device -> https://github.com/mnederlof/com.ubnt.unifi/blob/sdk-v2/drivers/wifi-client/driver.js#L495
Updating clients regularly:
/stat/sta -> https://github.com/mnederlof/com.ubnt.unifi/blob/sdk-v2/drivers/wifi-client/driver.js#L451
Something to do with usergroups (see #16)
/list/usergroup -> https://github.com/mnederlof/com.ubnt.unifi/blob/sdk-v2/drivers/wifi-client/driver.js#L518
Closing for inactivity.