allocBytes returns the number of bytes allocated by invoking f.
(f func())
| 759 | |
| 760 | // allocBytes returns the number of bytes allocated by invoking f. |
| 761 | func allocBytes(f func()) uint64 { |
| 762 | var stats runtime.MemStats |
| 763 | runtime.ReadMemStats(&stats) |
| 764 | t := stats.TotalAlloc |
| 765 | f() |
| 766 | runtime.ReadMemStats(&stats) |
| 767 | return stats.TotalAlloc - t |
| 768 | } |
| 769 | |
| 770 | func mallocNum(f func()) uint64 { |
| 771 | var stats runtime.MemStats |
no outgoing calls
no test coverage detected