Skip to content

Memory leak in Process.run and Process.start #50689

@au-top

Description

@au-top

Windows Platform

run code

import 'dart:io';

void main() async {
  for (var var_name = 0; var_name < 999999; var_name) {
    await Process.run("dir", []);
  }
}

I found that the memory was not properly released

And the same problem occurred when I used Process.start

Memory will increase rapidly in the former case

In the latter case, it will increase slowly

void main() async {
  for (var var_name = 0; var_name < 999999; var_name) {
    final p = await Process.start("dir", []);
    await p.stdout.toList();
    await p.stderr.toList();
    p.kill();
  }
}

I don't think this is the case that GC is not called immediately, because I observed the same situation in another dart program used for long-term running. The memory continues to increase from 8M=>100M within an hour

I observed the DART development tool and found that the RSS memory on the chart continued to increase

dart verson

Dart SDK version: 2.17.5 (stable) (Tue Jun 21 11:05:10 2022 +0200) on "windows_x64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-iotriagedIssue has been triaged by sub team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions