perf: cap hero decode, lower desktop image eviction threshold

This commit is contained in:
edde746
2026-04-25 11:59:56 +02:00
parent 5d87c6808d
commit c2cd2dea37
2 changed files with 10 additions and 6 deletions
+3 -6
View File
@@ -417,8 +417,8 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
if (PlatformDetector.isDesktopOS()) {
_memoryCheckTimer = Timer.periodic(const Duration(seconds: 30), (_) {
final rss = ProcessInfo.currentRss;
if (rss > 1536 * 1024 * 1024) {
// 1.5GB
if (rss > 1024 * 1024 * 1024) {
// 1GB
appLogger.w('RSS high ($rss bytes), evicting image caches');
_evictImageCaches();
}
@@ -592,10 +592,7 @@ class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
// SQLite WAL mode handles process death; desktop uses onExitRequested.
InAppReviewService.instance.endSession();
if (PlatformDetector.isDesktopOS()) {
if (ProcessInfo.currentRss > 1024 * 1024 * 1024) {
// 1GB
_evictImageCaches();
}
_evictImageCaches();
}
case AppLifecycleState.inactive:
case AppLifecycleState.hidden:
+7
View File
@@ -1382,11 +1382,18 @@ class _DiscoverScreenState extends State<DiscoverScreen>
imageType: ImageType.art,
);
final (_, memHeight) = PlexImageHelper.getMemCacheDimensions(
displayWidth: (screenWidth * dpr).round(),
displayHeight: (heroHeight * dpr).round(),
imageType: ImageType.art,
);
return blurArtwork(
CachedNetworkImage(
imageUrl: imageUrl,
cacheManager: PlexImageCacheManager.instance,
fit: BoxFit.cover,
memCacheHeight: memHeight,
placeholder: (context, url) =>
ColoredBox(color: Theme.of(context).colorScheme.surfaceContainerHighest),
errorWidget: (context, url, error) =>