mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
change cache
This commit is contained in:
@@ -20,9 +20,18 @@ func FreeOSMem() {
|
|||||||
debug.FreeOSMemory()
|
debug.FreeOSMemory()
|
||||||
}
|
}
|
||||||
|
|
||||||
func FreeOSMemGC() {
|
func FreeOSMemGC(maxAlloc int64) {
|
||||||
runtime.GC()
|
if maxAlloc <= 0 {
|
||||||
debug.FreeOSMemory()
|
runtime.GC()
|
||||||
|
debug.FreeOSMemory()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var m runtime.MemStats
|
||||||
|
runtime.ReadMemStats(&m)
|
||||||
|
if m.Alloc > uint64(float32(maxAlloc)*2) {
|
||||||
|
runtime.GC()
|
||||||
|
debug.FreeOSMemory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
Reference in New Issue
Block a user