Dart ProcessInfo
last modified April 4, 2025
The ProcessInfo
class in Dart provides information about the
current process. It's part of the dart:io
library.
ProcessInfo
is a utility class that exposes process-related
metrics. It provides static methods to access information about the running Dart
process.
Memory Usage Statistics
This example demonstrates how to check memory usage of the current process.
import 'dart:io'; void main() async { var memory = await ProcessInfo.currentRss; print('Resident Set Size: ${memory ~/ 1024} KB'); var maxRss = await ProcessInfo.maxRss; print('Maximum RSS: ${maxRss ~/ 1024} KB'); }
We use currentRss
for current memory usage.
The maxRss
returns the high-watermark in bytes for the resident set
size of memory for the process. Note that the meaning of this field is platform
dependent. For example, some memory accounted for here may be shared with other
processes, or if the same page is mapped into a process's address space, it may
be counted twice
$ dart main.dart Resident Set Size: 24576 KB Maximum RSS: 25600 KB
Source
Dart ProcessInfo Documentation
This tutorial covered Dart's ProcessInfo
class.
Author
List all Dart tutorials.