Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
runtime/pprof: add ReadMaps preloading API #30609
What version of Go are you using (
Based on investigation of internal Google patch, it looks like what you need is a function pprof.ReadMaps that can be called before the process enters "restricted" mode. That function would read and save whatever is needed for the maps (/proc/self/maps, anything from libraries listed there, etc) and then future profiles would reuse that. Only programs that need to run in this kind of restricted mode would need ReadMaps. (It's not something we need to ask everyone to use.)
Also, the implementation should not cache maps from profile to profile when ReadMaps has not been called. A profile taken before loading a plugin should not make a profile taken after loading the plugin have an incomplete maps list.
Given that understanding, this proposal seems quite unobtrusive and fine to add.
Will leave open for any additional discussion but we can probably accept it at our next review.