Debug

The debug package within the runtime gives us many functions and types that are available for debugging.  We have the ability to do the following:

  • Force a garbage collection using FreeOSMemory().
  • Print the stack trace that was generated at runtime. Stack to stderr using PrintStack().
  • Read our garbage collection stats using ReadGCStats().
  • Set our garbage collection percentage using SetGCPercent().
  • Set our max stack size for a single goroutine using SetMaxStack().
  • Set our maximum number of OS threads using SetMaxThreads().
  • Control the runtime behavior while faulting on an unexpected address using SetPanicOndefault().
  • Set the amount of traceback using SetTraceback().
  • Return the stack trace of a goroutine using Stack().
  • Write a heap dump using WriteHeapDump().
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.4.181