Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:40:28+00:00 2026-06-15T20:40:28+00:00

How to use pprof in Go program? There is a Go package named net/http/pprof

  • 0

How to use pprof in Go program?

There is a Go package named net/http/pprof,but I can’t use it.

The document says go tool pprof http://localhost:6060/debug/pprof/heap ,which does not work.

And,what does the below _ mean?

import _ "net/http/pprof"

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:40:30+00:00Added an answer on June 15, 2026 at 8:40 pm

    Based on your comment, the issue might be that you’re not using the correct port number.

    If you are running an http server at http://localhost:9997, then I think you want to run the command with http://localhost:9997:

    $ go tool pprof http://localhost:9997/debug/pprof/heap
    

    According to the net/http/pprof pkg doc page, if your application is already running an http server you do not need to start one and only need to include the import _ "net/http/pprof" somewhere in your program. http://localhost:6060 is the server started as an example and the host and port are arbitrary.

    import _ "net/http/pprof" means the package is imported but you do not use any of its exported identifiers. According to the go language spec, this will import the package solely for its side effects. These side effects involve, I think, the execution of the init() functions defined in the package’s source files and, apparently, registered variables.

    Also, you might find this blog post helpful:

    http://blog.golang.org/2011/06/profiling-go-programs.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is it possible to use geom_ribbon from the package ggplot2, but with the range
Use of java.net.URLConnection is asked about pretty often here, and the Oracle tutorial is
I’d like to use the VHD from MS in Win 7 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27417 Which Win
I noticed I can use getName() as part of the trick. What is java.awt.Component.getName()
I was attempting to use the following if/else statements to build a query, but
Sorry for the disturbance but can you help me in my problem? I'm new
I have to use the gdLibrary ( http://www.libgd.org ) in a C++ App on
Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt
I'd like to profile my JRuby app. For MRI I always use ruby-prof, but
Use Case Show a photo uploaded by the user in a square box with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.