That should be good enough. According to Crashlytics there was several different crashes but all have the same root java.lang.OutOfMemoryError
cause.. like the one below:
Fatal Exception: java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again
at java.lang.Thread.nativeCreate(Thread.java)
at java.lang.Thread.start(Thread.java:887)
at com.jjoe64.motiondetection.motiondetection.MotionDetector.onResume(MotionDetector.java:127)
at com.jpage4500.hubitat.ui.activities.ScreenSaverActivity.onResume(ScreenSaverActivity.java:121)
I can look at ways to free up memory; I do cache all of the devices in memory but this typically isn't much.. with the occasional exception where some custom device drivers do have a lot of extra attributes that the app will never use. Here's my weather driver for example:
Weather Details
{
"name": "Weather",
"label": "Weather",
"type": "OpenWeatherMap-Alerts Weather Driver",
"id": "383",
"date": "2022-09-05T14:24:32+0000",
"model": null,
"manufacturer": null,
"capabilities":
[
"RelativeHumidityMeasurement",
"Refresh",
"PressureMeasurement",
"IlluminanceMeasurement",
"UltravioletIndex",
"TemperatureMeasurement",
"Sensor"
],
"attributes":
{
"percentPrecip": "100",
"dataType": "NUMBER",
"values": null,
"forecastIcon": "rain",
"forecastMorn": "71",
"windSpeed": null,
"weather": "Heavy intensity rain",
"forecastEve": "75",
"feelsLike": "76",
"condition_code": null,
"pressure": "30",
"forecastHigh": "80",
"condition_iconWithText": null,
"illuminance": "3590",
"last_observation_Forecast": null,
"Precip2": null,
"condition_icon": null,
"sunsetTime": null,
"threedayTile": null,
"Precip0": null,
"condition_text": null,
"myTile": null,
"forecastLow": "69",
"alert": null,
"tw_end": null,
"wind_string": null,
"rainToday": "1",
"weatherIcons": null,
"wind_gust": null,
"condition_icon_only": null,
"condition_icon_url1": "https://tinyurl.com/y6xrbhpf/39.png",
"noonTime": null,
"windDirection": null,
"condition_icon_url2": "https://tinyurl.com/y6xrbhpf/39.png",
"pressured": " 30",
"forecastMorn1": "69",
"cloudDayAfterTomorrow": null,
"ultravioletIndex": "2.09",
"forecastLow1": "69",
"last_poll_Forecast": null,
"Precip1": null,
"rainTomorrow": "0",
"cloudTomorrow": null,
"forecast_text2": null,
"wind_cardinal": null,
"forecastHigh2": "90",
"localSunrise": "6:58 AM",
"dewpoint": null,
"forecast_code": null,
"alertTile": null,
"forecastNight1": "72",
"tw_begin": null,
"wind_direction": null,
"forecastDay1": "87",
"forecast_text1": null,
"vis": null,
"sunriseTime": null,
"localSunset": "7:45 PM",
"alertSender": null,
"temperature": "75",
"betwixt": null,
"humidity": "92",
"condition_icon_url": "https://tinyurl.com/y6xrbhpf/39.png",
"PoP2": "92",
"forecast_text": null,
"cloudToday": null,
"forecastDay": "78",
"wind": "2",
"weatherSummary": "Weather summary for Matthews updated at 10:24 AM on 9/5/2022. Heavy intensity rain with a high of 80°F and a low of 69°F. Humidity is 92% and the temperature is 75°F. The temperature feels like it is 76°F. Wind: Light air from the South-Southeast at 2 MPH, gusts: up to 2 MPH. There is a 100% chance of precipitation. Visibility is around 6 miles.",
"wind_degree": null,
"alertDescr": null,
"forecastNight": "71",
"forecastEve1": "84",
"cloud": null,
"weatherIcon": "rain",
"forecastHigh1": "91",
"rainDayAfterTomorrow": "0",
"is_day": "true",
"PoP1": "88",
"city": "Matthews",
"illuminated": null,
"threedayfcstTile": null,
"forecastLow2": "70"
},
"commands":
[
{
"command": "pollData"
},
{
"command": "refresh"
}
]
}
If the app knows what attributes it's actually interested in, it can ignore all the others and save a little memory... but at the end of the day it's not even close to how much memory images or video take up.
What I'd like to do is figure out when available memory is getting low and be able to temporarily disable or delay displaying an image or pause a live video feed instead of the app crashing. I do already get notified when the OS is running low on memory so I just need to figure out the second part of that