Misc resource fixes/improvements

* Add --pprof flag to server to enable profile debugging.
* Don't cache the resource content, it seem to eat memory on bigger sites.
* Keep --printMemoryUsag running in server

Fixes #11974
This commit is contained in:
Bjørn Erik Pedersen 2024-02-02 16:00:48 +01:00
parent d0788b96ae
commit 2873324898
7 changed files with 58 additions and 65 deletions

View file

@ -22,6 +22,7 @@ import (
"os"
"os/signal"
"path/filepath"
"runtime"
"strings"
"sync"
"sync/atomic"
@ -341,8 +342,12 @@ func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args
if r.buildWatch {
defer r.timeTrack(time.Now(), "Built")
}
err := b.build()
return err
close, err := b.build()
if err != nil {
return err
}
close()
return nil
}()
if err != nil {
return err
@ -411,6 +416,7 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
MaxEntries: 1,
OnEvict: func(key int32, value *hugolib.HugoSites) {
value.Close()
runtime.GC()
},
})