aboutsummaryrefslogtreecommitdiff
path: root/http_handle_index.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-09 16:33:51 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-09 16:33:51 +0800
commitc8f7040fe57d5f16a0a54c2cd85424511d537ad3 (patch)
tree87883109453eb3f87ab3052919109f49efb80361 /http_handle_index.go
parentgc: Add a garbage collection button (diff)
downloadforge-c8f7040fe57d5f16a0a54c2cd85424511d537ad3.tar.gz
forge-c8f7040fe57d5f16a0a54c2cd85424511d537ad3.tar.zst
forge-c8f7040fe57d5f16a0a54c2cd85424511d537ad3.zip
index: Show allocated bytes
Diffstat (limited to 'http_handle_index.go')
-rw-r--r--http_handle_index.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/http_handle_index.go b/http_handle_index.go
index 4632526..623c619 100644
--- a/http_handle_index.go
+++ b/http_handle_index.go
@@ -5,6 +5,7 @@ package main
import (
"net/http"
+ "runtime"
)
func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any) {
@@ -17,5 +18,10 @@ func handle_index(w http.ResponseWriter, r *http.Request, params map[string]any)
return
}
params["groups"] = groups
+
+ // Memory currently allocated
+ memstats := runtime.MemStats{}
+ runtime.ReadMemStats(&memstats)
+ params["mem"] = memstats.Alloc
render_template(w, "index", params)
}