dart-lang / watcher

A file system watcher library for Dart.
https://pub.dev/packages/watcher
BSD 3-Clause "New" or "Revised" License
138 stars 35 forks source link

High memory usage when watching on large folder #98

Open quangbuule opened 3 years ago

quangbuule commented 3 years ago

Hi team, I see that this console app costs ~1GB of Memory while running, is this as expected?

Dart SDK version: 2.12.0-29.0.dev (dev) (Mon Nov 9 06:42:00 2020 -0800) on "macos_x64"

import 'package:watcher/watcher.dart';
void main(List<String> arguments) async {
  final watcher = DirectoryWatcher('/Users/home/FolderWithMillionsOfFiles');
  watcher.events.listen((event) async {
    print('File ${event.type}: ${event.path}');
  });
  await Future.delayed(Duration(days: 1));
}

pubspec.yaml

name: file_watcher
description: A simple command-line application.
# version: 1.0.0
# homepage: https://www.example.com

environment:
  sdk: '>=2.10.0 <3.0.0'

dependencies:
  watcher: ^0.9.7+15

dev_dependencies:
  pedantic: ^1.9.0

Thanks.

JaffaKetchup commented 2 years ago

I need to know about this as well.

ristiisa commented 2 years ago

@quangbuule can you still repro it?