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

[Bug]: Unnecessarily created closure environments take up lots of memory while compiling Ballerina projects #41448

Closed
gimantha opened this issue Sep 26, 2023 · 1 comment
Assignees
Labels
needTriage The issue has to be inspected and labeled manually Priority/Blocker Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation
Milestone

Comments

@gimantha
Copy link
Contributor

Description

This is related to issue #41407. When we define an annotation, we represent the annotation with a lambda function in desugaring phase. The variables can be referred inside the annotation and they can therefore be closures. If we have lots of annotations we clone the closure environments in multiple places and they are not getting cleaned up properly. This can cause Out-of-memory issues when compiling larger projects.

Steps to Reproduce

  1. Create a project and include the following code snippet in main.bal.
import ballerina/io as _;
import ballerinax/health.fhir.r4 as _;
import ballerinax/health.fhir.r4.international401 as _;
import ballerinax/health.hl7v2 as _;
import ballerinax/health.hl7v2.utils.v2tofhirr4 as _;
import ballerinax/health.hl7v23 as _;
import ballerinax/health.hl7v2commons as _;
  1. Delete the folder ~/.ballerina
  2. Compile the project.

Affected Version(s)

2201.7.x

OS, DB, other environment details and versions

No response

Related area

-> Compilation

Related issue(s) (optional)

#41407

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot added needTriage The issue has to be inspected and labeled manually userCategory/Compilation labels Sep 26, 2023
@gimantha gimantha added Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Priority/Blocker labels Sep 26, 2023
@gimantha gimantha added this to the 2201.7.3 milestone Sep 26, 2023
@github-actions
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needTriage The issue has to be inspected and labeled manually Priority/Blocker Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug userCategory/Compilation
Projects
None yet
Development

No branches or pull requests

2 participants