mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-31 16:27:24 +02:00
perf(memory): release Go heap and decoded image caches on OS memory pressure
This commit is contained in:
@@ -2,9 +2,19 @@ package gobackend
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ReleaseMemory drops idle pooled extension runtimes, forces a GC, and
|
||||
// returns freed heap to the OS. Called from the app on OS memory pressure and
|
||||
// when backgrounded, so the Go side's RSS doesn't sit at its high-water mark
|
||||
// after large downloads/tag writes.
|
||||
func ReleaseMemory() {
|
||||
drainAllIsolatedRuntimePools()
|
||||
debug.FreeOSMemory()
|
||||
}
|
||||
|
||||
func CheckAvailability(spotifyID, isrc string) (string, error) {
|
||||
client := NewSongLinkClient()
|
||||
availability, err := client.CheckTrackAvailability(spotifyID, isrc)
|
||||
|
||||
Reference in New Issue
Block a user