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

(Possible) Memory Leaks #248

Open
MichaelDarkMostIo opened this issue May 7, 2024 · 12 comments
Open

(Possible) Memory Leaks #248

MichaelDarkMostIo opened this issue May 7, 2024 · 12 comments
Assignees
Labels
bug Something isn't working

Comments

@MichaelDarkMostIo
Copy link

It looks like custom_lint_client process is consuming more RAM than the whole analysis_server.

Screenshot 2024-05-07 at 13 58 51

Not sure what kind of related info I should provide for the issue, but it must be either a lack of optimization or memory leaks problem.

@MichaelDarkMostIo MichaelDarkMostIo added the bug Something isn't working label May 7, 2024
@EArminjon
Copy link

EArminjon commented May 17, 2024

Got same observation, didn't know why but when enabling this plugin i got a lot heavy CPU usage.

include: package:lint/analysis_options.yaml

custom_lint:
  enable_all_lint_rules: false
  rules:
    - use_design_system_item:
      AppExpansionPanel:
        - instead_of: ExpansionPanelList
          from_package: flutter

analyzer:
  plugins:
    - custom_lint
  errors:
    missing_required_param: error
    missing_return: error
    todo: ignore
    parameter_assignments: warning
    invalid_annotation_target: ignore
    unnecessary_constructor_name: true
  exclude:
    - lib/**/generated/**
    - test/**/generated/**
    - forked/
    - test/tmp/**

linter:
  rules:
    always_put_control_body_on_new_line: false
    always_put_required_named_parameters_first: true
    always_specify_types: true
    always_use_package_imports: false
    avoid_equals_and_hash_code_on_mutable_classes: true
    avoid_redundant_argument_values: false
    avoid_relative_lib_imports: false
    avoid_renaming_method_parameters: true
    avoid_returning_this: true
    constant_identifier_names: false
    flutter_style_todos: true
    no_default_cases: true
    no_wildcard_variable_uses: false
    overridden_fields: false
    prefer_asserts_with_message: true
    prefer_const_constructors: true
    prefer_const_constructors_in_immutables: true
    prefer_const_declarations: true
    prefer_const_literals_to_create_immutables: true
    prefer_constructors_over_static_methods: true
    prefer_relative_imports: true
    prefer_spread_collections: true
    prefer_single_quotes: true
    sort_child_properties_last: true
    sort_pub_dependencies: false
    sized_box_for_whitespace: true
    sized_box_shrink_expand: true
    unawaited_futures: true
    unnecessary_const: true
    use_colored_box: true
    use_decorated_box: true
    use_enums: true
    use_key_in_widget_constructors: true
    use_named_constants: true
    use_super_parameters: true
    use_to_and_as_if_applicable: true

@victor-tinoco
Copy link

I'm running the same as well. This consumes the CPU and slows my laptop down in a way I'm kinda obligated to open the Activity Monitor and just kill it all the time.

@victorcatn
Copy link

victorcatn commented Jun 27, 2024

This issue was slowing significantly my IDE, just navigating with cmd+clic was taking tens of seconds and saving dart files was taking minutes if not crashing.
It happened in multiple projects using custom_lint and riverpod_lints.
I tried with a new computer and a clean SO + Flutter install and the issue happened again.
I also tried switching from VScode to Android Studio but the flutter outline and dart refactors stopped working after a few seconds of use and become unusable, after disabling custom_lint it works normally
For now I had to disable custom_lint in all my projects to get a normal development flow

@amrgetment
Copy link

I confirmed same issue but it wasn’t there 1 month ago

@rrousselGit
Copy link
Collaborator

Do you have any error in the custom_lint.log or something?

@amrgetment
Copy link

amrgetment commented Jun 28, 2024

No errors, I use those linters:

dev_dependencies:
  # Linters
  flutter_lints: ^4.0.0
  autoclose_lint: ^1.0.2
  custom_lint: ^0.6.4
  freezed_lint: ^0.0.2
  solid_lints: ^0.1.5

I use prefer_match_file_name from solid_lints but I don’t think it is related to the memory issue, and once I disable

 # plugins:
 #  - custom_lint

no memory issues after disabling

analysis_options.yaml.zip

@amrgetment
Copy link

I will activate it again and I will let you know if I got errors

@rrousselGit
Copy link
Collaborator

For what it's worth, I'm making significant changes to support analyzer 6.5.0.
Hopefully this should get better.

Still, in terms of memory, it's always going to consume quite a bit.

Anyway note that the memory issue could be coming from a specific plugin. For instance, it could be that riverpod_lint is the problem. I could see how that happens, as it does a lot of caching.

@amrgetment
Copy link

macros will improve build_runners
what would be the feature in the dart that could improve the analyzer?

@rrousselGit
Copy link
Collaborator

Not a Dart feature but an analyzer feature. Plugins are getting a rework to solve memory issues.

@EArminjon
Copy link

EArminjon commented Jun 28, 2024

What about CPU usage 👀 ? (I can open a new GitHub issue)

Thanks for your amazing package ❤️

@rrousselGit
Copy link
Collaborator

Depends. Note that there could always be a bug in any of the packages.

For example I'm aware of at least one performance issue caused by some form of delayed infinite loop in riverpod_lint. I'm working on fixing this at the moment.

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

6 participants