diff --git a/app/console/commands/panel_task.go b/app/console/commands/panel_task.go index a3efda82..60ac4200 100644 --- a/app/console/commands/panel_task.go +++ b/app/console/commands/panel_task.go @@ -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 } diff --git a/bootstrap/app.go b/bootstrap/app.go index c5e22b34..c2e6465f 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -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()