Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart consumes excessive RAM when part directive is missing in freezed-generated code #1117

Open
AntoniPochopien opened this issue Aug 5, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@AntoniPochopien
Copy link

Description
When using the freezed package in Flutter, if the part directive is not annotated with the .freezed.dart file name, Dart starts consuming a significant amount of RAM. The memory usage keeps increasing with each passing second. The freezed process in the console becomes unresponsive, and even after stopping the file generation process, Dart continues to consume more RAM. The only way to stop this is by manually killing the Dart process.

Note
I want to note that this is not a critical bug, since it comes from developer wrong usage of the package, but I think that this scenario should be handled somehow to prevent such resource consumption issues.

To Reproduce

  1. Create a new Flutter project.
  2. Add the freezed package to pubspec.yaml.
  3. Create a Dart file with a freezed class but forget to add the part directive with the .freezed file name. eg. part 'x.dart';
  4. Run the build runner to generate the code.

Expected behavior
An error should be thrown or the process should stop without consuming excessive RAM.

Actural behavior
The Dart process starts consuming more RAM continuously, and the freezed process gets stuck. The RAM usage keeps increasing until the Dart process is manually killed.

Environment
Dart SDK version: 3.4.4
Flutter version: 3.22.3 stable
freezed version: 2.4.7
freezed annotation version: 2.4.1
Operating System: Windows 10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants