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

Memory leak when running project #1752

Closed
PaigeM89 opened this issue Jul 25, 2022 · 23 comments
Closed

Memory leak when running project #1752

PaigeM89 opened this issue Jul 25, 2022 · 23 comments
Labels
language services Problems related to language services - FSAC or FCS performance Problems related to Ionide performance

Comments

@PaigeM89
Copy link
Contributor

Describe the bug

When running Ionide on my main work solution, it works fine up until I run the project(s). When I do, Ionide will continue to work but will continually use up more and more RAM until I'm forced to kill the service - just now, it was sitting on 18 gigs of ram & slowing my machine to a crawl. I can consistently recreate this - or, more accurately, every time I run the projects, I get a memory leak.

I'm the only person on my team with this issue at all, and it only happens for one solution. However, this is a pretty big solution - 32 individual projects. I haven't had this issue across any other solutions, just this one. It might be worth noting that it appears that Ionide uses up a fair amount of memory even when running fine - without the issue currently happening, it's sitting on 2.8 gigs of RAM.

Steps to reproduce

  1. Open up my main work solution on my laptop
  2. Launch it from the terminal via tye
  3. Watch ram usage skyrocket

Machine info

  • OS: Mac 12.2.1, has happened for a few versions
  • .NET SDK version: Has happened for a few versions now, currently happens on 5.0.404
  • Ionide version: Has happened for a few versions now, currently happens on 7.0.0

Additional context

We use tye for running our containers & orchestrating our services, but I'm able to get a memory leak when running the services "normally".

Let me know what I can provide to debug this. I took a memory dump, but it's 11 gigs and I can't open it on my OS (so I don't even know if it's working).

@PaigeM89
Copy link
Contributor Author

I can even get this to happen without any processes running, which is interesting & uncommon.

@aonyxrocks
Copy link

aonyxrocks commented Jul 25, 2022

Same issue here. But the project I am working on is very small. Just an Azure function and a Pulumi project. This seems to be triggered just by editing code and/or displaying intellisense. The point where it got in the way of getting any development done was when working on some nested CEs (Pulumi.FSharp.AzureNative).
I downgraded to v6 which does not behave as badly (CPU/memory consumption is still an issue but nowhere near as bad).

  • Windows 10
  • .NET SDK 6.0.302
  • Libraries used in the projects:
    • Azure.Identity
    • Azure.ResourceManager
    • Azure.ResourceManager.Resources
    • Azure.Security.KeyVault.Secrets
    • Farmer
    • FsToolkit.ErrorHandling
    • Pulumi
    • Pulumi.AzureNative
    • Pulumi.FSharp
    • Pulumi.FSharp.AzureNative
    • Pulumi.FSharp.Core

Edit: It looks like even v6 has this problem but is much slower to consume the resources, so it is not as noticable.

@sebfia
Copy link

sebfia commented Jul 25, 2022

Same issue here.
Machine: MBP ARM64

@jormal
Copy link

jormal commented Jul 26, 2022

Same issue here.
Machine: Mac mini (M1, 2020) ARM64
OS: macOS 12.4

Also, when I downgraded the Ionide to 6.0.6, this situation doesn't occur.

@Krzysztof-Cieslak Krzysztof-Cieslak added performance Problems related to Ionide performance language services Problems related to language services - FSAC or FCS labels Jul 26, 2022
@wallymathieu
Copy link

I'm getting a spike in the CPU usage on Air M1 8GB when I open up
https://github.com/wallymathieu/auctions-site
I'm using .net version 6.0.302

@wallymathieu
Copy link

It's fine when I'm using Rider or Visual Studio for Mac though.

@sleepyfran
Copy link

Same as @wallymathieu on my M1, after opening a file dotnet CPU's usage skyrockets and stays until I kill VSCode:
image

Not sure if there's a way to report any performance logs, if so I can attach them since it happens continously.

@sebfia
Copy link

sebfia commented Aug 9, 2022 via email

@forki
Copy link
Contributor

forki commented Aug 9, 2022

same here. Switching back to 6.0.6 solves it.

@draganjovanovic1
Copy link

Confirming high CPU usage on M1 Max with ionide 7.0.0. (all performance cores and fans to the max, melting aluminum :) ). Tried to let it for an hour hoping it will do it's work and calm down but didn't happen. Reverted to 6.0.6 and working again in quiet :)

@baronfel
Copy link
Contributor

This is probably due to a lot of rework that we are doing during checking. @Krzysztof-Cieslak has a draft PR to correct some of that that we are working through.

@kevingentile
Copy link

Can confirm this issue in v7.0.0 ( In v7.1.0 I was mostly impacted by #1769 ):

  • Windows 10
  • .NET SDK 6.0.303

Rollback to 6.0.6 seems to resolve issues.

Workaround is a manual restart of extension host in VSCode. But this pops up frequently enough that it's probably best to roll-back. Is there an easy way to trigger a restart of the Ionide extension only?

@baronfel
Copy link
Contributor

@kevingentile there is not. This was solved in 7.1.0, and #1769 should be resolved in the next version, so really all I can advise you to do is hold tight.

@baronfel
Copy link
Contributor

Closing because 7.1.0 solved this particular issue.

@wallymathieu
Copy link

It's still not working on 7.1 for macos

@baronfel baronfel reopened this Aug 24, 2022
@TheAngryByrd
Copy link
Member

Can you try with the AdaptiveLSPServer?
image

@wallymathieu
Copy link

M1, Ionide v7.4.2, .net 7.0.200. CPU is stable. I've tried both with FSharp: Enable Adaptive Lsp Server enabled and not. For the project auctions-site it seems like the CPU issue is fixed.

@wallymathieu
Copy link

.net is around 1.6 GB after maybe 30 minutes.

@cartermp
Copy link
Contributor

FWIW I think 1.6GB of memory usage on 64-bit out-of-proc for a project using FSharpPlus isn't too out of the ordinary.

@wallymathieu
Copy link

wallymathieu commented Feb 19, 2023

It's now 1.8 GB.

@TheAngryByrd
Copy link
Member

You may want to use some type of memory dump to analyze what is taking up memory. When I did it for my giant work project, it takes quite a bit of memory but it's almost entirely inside FSharp.Compiler.Service which we don't have much control over (please let me know if there's better memory controls).

Additionally try setting DOTNET_GCConserveMemory=9 environment variable before starting vscode as I've noticed this will help the GC be more aggressive at cleaning up Large Object Heap allocations in FSharp.Compiler.Service.

@wallymathieu
Copy link

I mean, there might be some memory leak. For my part the biggest issue is solved (that you couldn't use it at all due to high CPU).

@TheAngryByrd
Copy link
Member

Ok I've done a lot of memory performance tuning over the months.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language services Problems related to language services - FSAC or FCS performance Problems related to Ionide performance
Projects
None yet
Development

No branches or pull requests