mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Add GC hints to prevent memory leaks from large byte arrays
This commit is contained in:
@@ -39,6 +39,12 @@ public class SubsonicProxyService
|
||||
var body = await response.Content.ReadAsByteArrayAsync();
|
||||
var contentType = response.Content.Headers.ContentType?.ToString();
|
||||
|
||||
// Trigger GC for large files to prevent memory leaks
|
||||
if (body.Length > 1024 * 1024) // 1MB threshold
|
||||
{
|
||||
GC.Collect(2, GCCollectionMode.Optimized, blocking: false);
|
||||
}
|
||||
|
||||
return (body, contentType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user