Source file src/runtime/rss_darwin.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  func sysRSSInit() {}
     8  
     9  // sysRSS returns the current resident set size of this process in bytes,
    10  // including pages shared with other processes. It does not break out the
    11  // shared portion. A zero RSS means it is unavailable.
    12  func sysRSS() (rss, shared uint64, hasShared bool) {
    13  	var info machTaskBasicInfo
    14  	if task_info(_MACH_TASK_BASIC_INFO, &info, _MACH_TASK_BASIC_INFO_COUNT) != 0 {
    15  		return 0, 0, false
    16  	}
    17  	return info.resident_size, 0, false
    18  }
    19  

View as plain text