Skip to content

perf: Avoid storing services as a field in long-lived components #6308

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

exigow
Copy link
Collaborator

@exigow exigow commented Jun 26, 2025

Description

Motivation: We should never acquire service instances prematurely or store them in fields for later use. This is considered as bad practice due to potential memory leaks. More details: https://plugins.jetbrains.com/docs/intellij/plugin-services.html#retrieving-a-service

FYI there's a nice extension method for retrieving services like project.service<MyService> or service<MyService> for application-level services (like Continue settings). I've applied this everywhere.

This fix is somewhat related to #5819

@exigow exigow requested a review from a team as a code owner June 26, 2025 13:23
@exigow exigow requested review from RomneyDa and removed request for a team June 26, 2025 13:23
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 26, 2025
Copy link

recurseml bot commented Jun 26, 2025

⚠️ Only 5 files will be analyzed due to processing limits.

Copy link

netlify bot commented Jun 26, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit ba37b57
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/685d49dbf26d96000812484b

Copy link

recurseml bot commented Jun 26, 2025

✨ No issues found! Your code is sparkling clean! ✨

Need help? Join our Discord for support!
https://discord.gg/NCpkJ4kF

We should never acquire service instances prematurely or store them in fields for later use.
This is considered as bad practice due to potential memory leaks.
More details: https://plugins.jetbrains.com/docs/intellij/plugin-services.html#retrieving-a-service

FYI there's a nice extension method for retrieving services like `project.service<MyService>` or `service<MyService>` for application-level services (like Continue settings). I've applied this everywhere.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant