question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

out of memory with big parts

See original GitHub issue

Steps to Reproduce

working within big files that have big (or maybe multiple?) part s makes editing laggy until AS runs out of memory, doesn’t seem to happen in VS Code.

some_class.dart part 'some_class.d.dart';

changing it to :

import 'some_class_part.dart';
export 'some_class_part.dart';

instantly makes editing faster, no more lag or out of memory errors

I’m not the only one noticing it : https://stackoverflow.com/questions/64734912/android-studio-running-out-of-memory-while-editing-big-multipart-dart-files

Version info

[✓] Flutter (Channel unknown, 1.22.2, on Mac OS X 10.15.7 19H15, locale en-BE)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 12.1) [✓] Chrome - develop for the web [!] Android Studio (version 4.1) ✗ Flutter plugin not installed; this adds Flutter specific functionality. ✗ Dart plugin not installed; this adds Dart specific functionality. [✓] VS Code (version 1.51.0)

[✓] Connected device (2 available)
! Error: Benoit’s iPhone is not connected. Xcode will continue when Benoit’s iPhone is connected. (code -13)

(happens as well on 1.22.2 stable)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Dec 10, 2020

@benoitskipr it’s an option in the VS Code settings:

Screenshot 2020-12-10 at 09 59 24

It’s off by default, so if you’re not aware of it you probably don’t have it enabled. In that case, VS Code would be caching AvailableSuggestionSets in its own process (although I’m not sure if there’s an easy way to get a memory dump to compare that to Android Studio).

1reaction
stevemessickcommented, Dec 9, 2020

I took a quick look at the log posted by @benoitskipr. There are some questionable entries. None of these are weak references.

13: [45.3K/1.45MB] [45.3K/1.45MB] org.dartlang.analysis.server.protocol.Location 14: [45.3K/2.71MB] [45.3K/2.71MB] org.dartlang.analysis.server.protocol.Element The OP did say the files are big, so maybe 45K instances of Location and Element is not unexpected.

15: [45.1K/3.61MB] [45.1K/3.61MB] org.dartlang.analysis.server.protocol.AvailableSuggestion I don’t remember what AvailableSuggestion is used for but it sounds like something in the UI and should not need so many instances. OTOH, big files might have that many.

16: [40.4K/ 647KB] [40.4K/ 647KB] io.flutter.run.ObservatoryFile$Position OK, big files, but it is still a lot of Position instances.

21: [26.3K/ 632KB] [26.3K/ 632KB] com.intellij.openapi.actionSystem.impl.ActionUpdater$$Lambda$1701 34: [16.1K/ 258KB] [16.1K/ 258KB] com.intellij.openapi.actionSystem.Presentation$$Lambda$461 I’d like to understand why we need 26K lambdas for ActionUpdater and 16K for Presentation.

36: [13.2K/ 727KB] [13.2K/ 727KB] com.intellij.openapi.actionSystem.AnActionEvent Is 13K instances of AnActionEvent expected?

37: [13.2K/ 317KB] [13.2K/ 317KB] io.flutter.view.FlutterViewToggleableAction$$Lambda$6414 Another lambda-count that makes me wonder if something is not quite right.

@alexander-doroshko is my intuition accurate (these are too big) or do the instance counts look reasonable to you?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Very large collection in .Net causes out-of-memory exception
You can have objects that are far, far larger than available physical memory because of course available physical memory could be zero when...
Read more >
Resolve "Out of Memory" Errors - MATLAB & Simulink
When your code operates on large amounts of data or does not use memory efficiently, MATLAB ® might produce an error in response...
Read more >
3.2 Understand the OutOfMemoryError Exception
One common indication of a memory leak is the java.lang.OutOfMemoryError exception. Usually, this error is thrown when there is insufficient space to ...
Read more >
8 Efficient Methods to Fix Chrome out of Memory Error [Solved]
Part 2: 8 Best Methods to Fix Chrome out of Memory · Method 1: Aiseesoft Mac Cleaner · Method 2: Block Flash on...
Read more >
Guide :: Fixing the Out of Memory Error - Steam Community
The 'Out of Memory' error can be triggered by various issues, and can therefore be tackled in several ways. When combined, these measures ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found