Garmin: re-use FitImporter to reduce memory pressure

This commit is contained in:
Thomas Kuehne
2026-05-01 10:43:15 +00:00
parent b8061337e2
commit f1ecc71716
@@ -38,6 +38,7 @@ public class FitAsyncProcessor {
new Thread(() -> {
try {
FitImporter fitImporter = null;
int i = 0;
for (final File file : files) {
i++;
@@ -47,10 +48,13 @@ public class FitAsyncProcessor {
FitAsyncProcessor.this.handler.post(() -> callback.onProgress(finalI));
try {
final FitImporter fitImporter = new FitImporter(context, gbDevice);
if (fitImporter == null) {
fitImporter = new FitImporter(context, gbDevice);
}
fitImporter.importFile(file, isReprocessing);
} catch (final Exception ex) {
LOG.error("Exception while importing {}", file, ex);
fitImporter = null;
continue; // do not remove from pending files
}