Skip to content

Analysis Server doesn't release memory after project close #24613

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

Closed
alexander-doroshko opened this issue Oct 16, 2015 · 9 comments
Closed

Analysis Server doesn't release memory after project close #24613

alexander-doroshko opened this issue Oct 16, 2015 · 9 comments
Assignees
Labels
devexp-server Issues related to some aspect of the analysis server legacy-area-analyzer Use area-devexp instead. P1 A high priority bug; for example, a single project is unusable or has many test failures type-performance Issue relates to performance or code size
Milestone

Comments

@alexander-doroshko
Copy link

  • Open some large project in the IDE.
  • Wait for Analysis Server to warm up, see how much memory is consumes using any Process Explorer.
  • Close project. IDE sends empty root list to the Analysis Server via analysis_setAnalysisRoots.
    After that I waited for several minutes, but Analysis Process still consumes several gigabytes of memory. (Windows 8.1, SDK 1.13-dev.7.0)
@alexander-doroshko alexander-doroshko added legacy-area-analyzer Use area-devexp instead. devexp-server Issues related to some aspect of the analysis server type-performance Issue relates to performance or code size labels Oct 16, 2015
@bwilkerson bwilkerson added Type-Defect P1 A high priority bug; for example, a single project is unusable or has many test failures labels Oct 16, 2015
@bwilkerson bwilkerson added this to the 1.14 milestone Oct 19, 2015
@scheglov
Copy link
Contributor

I open the project with analyzer and analysis_server modules.
After analysis is done DAS "used" Old Generation is "595.4MB of 604.6MB".
I close project and "used" Old Generation is "82.6MB of 420.6MB".
When I repeat opening and closing the project I get similar number.

So, I guess DAS does release the memory, but VM still keeps some of it allocated.

@johnmccutchan @iposva-google Does VM release memory to OS when the application stops using so much memory?

@iposva-google
Copy link
Contributor

In your example the VM released about 200MB back to the OS, but keeps some memory around expecting you to grow again. Which is what your get when you reopen a project again.

@scheglov
Copy link
Contributor

@iposva-google Yes, I see that it releases some memory. I'd like to understand it better - what is an approximate algorithm here? Does VM release memory up to some fixed size, like 400MB or up to some percentage of the max heap size, or...?

@scheglov
Copy link
Contributor

I think we have found the/a reason why memory is not released after closing a big project.
This is especially true for projects with many legacy packages/ folders.
https://codereview.chromium.org/1447603004

scheglov added a commit that referenced this issue Nov 14, 2015
We need not just to cancel the subscription, but also to remove it from the map.

It's not so bad now for the MDL project, but any similar project will use a lot
of memory even after closign the project. This may be the reason of one of
the issues opened against DAS.

[email protected], [email protected]
BUG= #24613

Review URL: https://codereview.chromium.org/1447603004 .
@scheglov
Copy link
Contributor

scheglov commented Dec 8, 2015

I believe the issue was fixed.

@scheglov scheglov closed this as completed Dec 8, 2015
@alexander-doroshko
Copy link
Author

I played a bit with today's 1.14.0-edge.674a2f6d90ea063b13a33a74d7bb010f062ae8fe:

  • Open big project. Memory consumed by the Analysis Server grows up to 3.45Gb
  • Close project. Wait 10 minutes. Memory stays at 3.45Gb
  • Open the same project again. Consumed memory drops to 1.1Gb and then grows to 3.65Gb
  • Close project and wait. Memory stays at 3.65Gb
  • Open the same project again. Memory drops to 1.5Gb and grows to 3.8Gb
  • Close this big project and open toy size 1-file project. Memory stays at 3.8Gb.

@scheglov
Copy link
Contributor

scheglov commented Dec 8, 2015

I would love to have / know this project for testing.

When I open the whole SDK repo, wait for analysis and close the project memory usage drops tenfold. But the allocated heap size does not. I opened a new issue against the VM.

image

@alexander-doroshko
Copy link
Author

I checked memory using Sysinternals' Process Explorer. It shows allocated memory. I think if I looked at it using Observatory I would also see that 90% of allocated memory not used.
The project I played with consists of several Mike's repositories, pub get done for all pubspecs:
image
.

@sircco
Copy link

sircco commented Mar 30, 2016

Sent: {"id":"49","method":"analysis.getErrors","params":{"file":"/home/dart/x/lib/c_wizard.dart"}}
this consumes around 100MB per file,

also if you do this (notice same file name)
Sent: {"id":"50","method":"analysis.getErrors","params":{"file":"/home/dart/x/lib/c_wizard.dart"}}
it will consume another 100-250MB

file is declaring a lib, creating object, nothing fancy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-server Issues related to some aspect of the analysis server legacy-area-analyzer Use area-devexp instead. P1 A high priority bug; for example, a single project is unusable or has many test failures type-performance Issue relates to performance or code size
Projects
None yet
Development

No branches or pull requests

5 participants