2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 13:47:15 +08:00

feat: 尝试优化内存

This commit is contained in:
耗子
2024-06-25 01:52:41 +08:00
parent 96bea2cf90
commit 1b836297bf
2 changed files with 10 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ package commands
import (
"context"
"runtime"
"runtime/debug"
"github.com/goravel/framework/contracts/console"
"github.com/goravel/framework/contracts/console/command"
@@ -68,6 +70,10 @@ func (receiver *PanelTask) Handle(console.Context) error {
return err
}
// 回收内存
runtime.GC()
debug.FreeOSMemory()
types.Status = types.StatusNormal
return nil
}

View File

@@ -1,6 +1,8 @@
package bootstrap
import (
"runtime/debug"
"github.com/gookit/validate/locales/zhcn"
"github.com/goravel/framework/foundation"
@@ -8,6 +10,8 @@ import (
)
func Boot() {
debug.SetGCPercent(20)
zhcn.RegisterGlobal()
app := foundation.NewApplication()