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

Debugger is very slow and uses too much memory when large lists are around #8024

Closed
DartBot opened this issue Jan 22, 2013 · 6 comments
Closed
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.

Comments

@DartBot
Copy link

DartBot commented Jan 22, 2013

This issue was originally filed by podivilov@google.com


  1. Create VM App:

import 'dart:scalarlist';

void main() {
  var list = new Int8List(16 * 1000 * 1000);
  print(list.length);
  print('ok');
}

  1. Set two breakpoints on both prints.
  2. Run application
  3. Debugger hangs for 50 seconds
  4. When debugger is finally paused on first print, hit continue
  5. "Exhausted heap space, trying to allocate 268435488 bytes." error message appears in console and debugger hangs again for another 50 seconds. After pausing it prints the error message once again.

Without breakpoints this same application runs to completion in less than a second.

This issue makes the debugger mostly unusable if you have large list in your program, so setting priority to high.

@devoncarew
Copy link
Member

Pavel, I added some code to the command-line debugger to display large lists in slices instead of the whole list at once. This was committed last week; can you confirm that the version you saw this behavior was trying to display slices?

@DartBot
Copy link
Author

DartBot commented Jan 22, 2013

This comment was originally written by podivilov@google.com


You are right. I was using an older version. The latest build looks much better, thanks!

Still, each debugger step takes ~5 seconds and I get lots of "Exhausted heap space, trying to allocate 268435488 bytes." messages in console, which perhaps indicate that something is going wrong.

Overall, the Editor is still quite slow when debugging the sample.

@DartBot
Copy link
Author

DartBot commented Jan 22, 2013

This comment was originally written by podivilov@google.com


Removed Priority-High label.
Added Priority-Medium label.

@DartBot
Copy link
Author

DartBot commented Jan 22, 2013

This comment was originally written by @mhausner


I think what's happening is that the wire protocol is calling the toString() method of the list variable to transmit a textual representation of the value. As a side effect, a huge buffer for the C string gets allocated. The wire protocol needs to be smarter when creating the textual value.


Added Accepted label.

@DartBot
Copy link
Author

DartBot commented Jan 23, 2013

This comment was originally written by @mhausner


I have a change that improves the situation. For this program:

void main() {
  var list = new List(1000);
  list[1] = new A();
  list[2] = 4.9;
  list[3] = new List(1000);
  list[4] = "The Fifth Element";
  list[5] = { "foo": 700 };
  print(list.length);
  print('ok');
}

class A {
  toString() => throw "foo!";
}

The wire protocol now submits this info when breaking at the print(ok) statement:

Isolate 7114 paused on breakpoint
Stack trace:
0 main (file:///Users/hausner/tmp/d.dart:10) (lib 15)
  list = (list, id 0, len 1000) [null, #ERROR, 4.9, [...], "The Fifth Element", {foo: 700}, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, ...]

Before this change, the debugger choked on this.

https://codereview.chromium.org/12033039/

@DartBot
Copy link
Author

DartBot commented Jan 24, 2013

This comment was originally written by @mhausner


Added another change (r17517) to restrict the length of the text that gets submitted. This problem should be solved now.


Added Fixed label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. labels Jan 24, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends.
Projects
None yet
Development

No branches or pull requests

2 participants