mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
runtime: move GC code around to prepare for precise GC
Most of the code of the conservative GC can be reused for the precise GC. So before adding precise GC support, this commit just moves code around to make the next commit cleaner. It is a non-functional change.
This commit is contained in:
@@ -64,6 +64,23 @@ func free(ptr unsafe.Pointer) {
|
||||
// Memory is never freed.
|
||||
}
|
||||
|
||||
// ReadMemStats populates m with memory statistics.
|
||||
//
|
||||
// The returned memory statistics are up to date as of the
|
||||
// call to ReadMemStats. This would not do GC implicitly for you.
|
||||
func ReadMemStats(m *MemStats) {
|
||||
m.HeapIdle = 0
|
||||
m.HeapInuse = gcTotalAlloc
|
||||
m.HeapReleased = 0 // always 0, we don't currently release memory back to the OS.
|
||||
|
||||
m.HeapSys = m.HeapInuse + m.HeapIdle
|
||||
m.GCSys = 0
|
||||
m.TotalAlloc = gcTotalAlloc
|
||||
m.Mallocs = gcMallocs
|
||||
m.Frees = gcFrees
|
||||
m.Sys = uint64(heapEnd - heapStart)
|
||||
}
|
||||
|
||||
func GC() {
|
||||
// No-op.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user