diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt index 477ca53e62..55509c7fc3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/configBuilder/ProfileFunctionImplementation.kt @@ -94,6 +94,11 @@ class ProfileFunctionImplementation @Inject constructor( @Synchronized override fun getProfile(time: Long): Profile? { + // Clear cache after longer use + if (cache.size() > 30000) { + cache.clear() + aapsLogger.debug("Profile cache cleared") + } val rounded = time - time % 1000 val cached = cache[rounded] if (cached != null) {