Commit 08b80ca 1 parent 92cc3c4 commit 08b80ca Copy full SHA for 08b80ca
File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -368,6 +368,9 @@ func (r *MemProfileRecord) Stack() []uintptr {
368
368
return r .Stack0 [0 :]
369
369
}
370
370
371
+ // MemProfile returns a profile of memory allocated and freed per allocation
372
+ // site.
373
+ //
371
374
// MemProfile returns n, the number of records in the current memory profile.
372
375
// If len(p) >= n, MemProfile copies the profile into p and returns n, true.
373
376
// If len(p) < n, MemProfile does not change p and returns n, false.
@@ -377,6 +380,12 @@ func (r *MemProfileRecord) Stack() []uintptr {
377
380
// These are sites where memory was allocated, but it has all
378
381
// been released back to the runtime.
379
382
//
383
+ // The returned profile may be up to two garbage collection cycles old.
384
+ // This is to avoid skewing the profile toward allocations; because
385
+ // allocations happen in real time but frees are delayed until the garbage
386
+ // collector performs sweeping, the profile only accounts for allocations
387
+ // that have had a chance to be freed by the garbage collector.
388
+ //
380
389
// Most clients should use the runtime/pprof package or
381
390
// the testing package's -test.memprofile flag instead
382
391
// of calling MemProfile directly.
You can’t perform that action at this time.
0 commit comments