Closed hollowaykeanho closed 7 months ago
I have no idea what this issue is about, so you need to make it more clear with some examples. And please inline them and not link to some discussion somewhere on the internet.
Basically, I'm requesting a partial function that is doing a Go template function against a given string, returning a string, without caching. Right now, I'm using hugo pipe to do the work as shown above.
The problem is hugo pipe did unnecessary caching and somehow the caches are not released back to garbage collector even hitting the 10 minutes marker, behaving like a "memory leak" seen in C language. It doesn't matter how big your computer's RAM is, it will occupy all the RAM as garbage collector can't recover those unused memory.
We're looking at 21%, then 46%, then 72%, then 100% of 16GB Memory, and then enter swap.
I detected there is a memory related issue here (Go programming language can't possibly "memory leak"). However, as presented in the Discourse discussion, I was not approached by anyone about any usable diagnostic tools to further root cause the problem.
I'm pretty sure it is Hugo Pipe because unfortunately, due to this issue, I was forced to stripped off quite a number of features (auto PWA caching, and etc). Hence, the entire theme is not using partialCached
or .Store
persistent scratchpad.
Reference function: https://github.com/ZORALab/Hestia/blob/experimental/hestiaHUGO/layouts/partials/hestiaSTRING/Sanitize
This function itself can handle string rendering with Go templating which is very powerful that it can remove the need of using Markdown and hugo speicfic shortcode which behaves like partial. So, with this function, the theme developer can only focus on partial functions and create a Go compatible codes that are reusable elsewhere.
I just pre-launch an outcome of my approach here: https://hestia.zoralab.com/ which proven that this vital function can indeed build good Hugo theme products.
Something like Strings.Process
(I made this up) :
{{- $Page := ... some dictionary data -}}
{{- $ret := Strings.Process $Page "This page is: {{ .Page.Permalink -}}" -}}
{{- warnf "%v\n" $ret -}}
----
The page is: http://localhost:8080/
----
Instead of:
{{- $Page := ... some dictionary data -}}
{{- $ret := "This page is: {{ .Page.Permalink -}}" -}}
{{- $filename = printf "deletable-%v-%v-%v-%v"
(mod (add (mul 13 now.Unix) 97) 400000)
(sha256 (string $Page.URL.Current.Absolute))
(now.Format "200601021504050700")
(crypto.FNV32a $ret)
-}}
{{- $ret = resources.FromString $filename $ret -}}
{{- $ret = resources.ExecuteAsTemplate $filename $Page $ret -}}
{{- $ret = string $ret.Content -}}
{{- warnf "%v\n" $ret -}}
----
The page is: http://localhost:8080/
----
Close this ticket since I'm no longer deploying Hugo.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Request
Basically to replace this:
Reason
Severity
The memory leak phenomeon can occupy all the memory space and even get into swap. The only way to use is to periodically kill hugo server and restart it.