jlfwong / jlfwong/speedscope

Not working for Golang's memory profiling

Open
#370 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
6.8k
Forks
320
PR merge metrics
No merged PRs in 30d

Description

First, thanks for this cool project! Seems that there is a bug when reading from the Go's memory profile:

```go
package main
import (
"fmt"
"net/http"
_ "net/http/pprof"
)
func hello(w http.ResponseWriter, req *http.Request) {
fmt.Fprintf(w, "hello\n")
}
func headers(w http.ResponseWriter, req *http.Request) {
for name, headers := range req.Header {
for _, h := range headers {
fmt.Fprintf(w, "%v: %v\n", name, h)
}
}
}
func main() {
http.HandleFunc("/hello", hello)
http.HandleFunc("/headers", headers)
http.ListenAndServe(":8090", nil)
}
```

```shell
curl http://127.0.0.1:8090/debug/pprof/heap\?seconds\=10 > heap_profile
```

When loading the `heap_profile`, error occurs:

```
Failed to load format Error: Samples must have positive weights
at n.appendSampleWithWeight (speedscope.026f36b0.js:174)
at r (/import.e3a73ef4.js:107)
at /import.e3a73ef4.js:115
at Generator.next ()
at s (/import.e3a73ef4.js:115)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.