Skip to content

Hovering over very large lists makes debugging unresponsive because results are not paged #5532

@jensjoha

Description

@jensjoha

Describe the bug (and reproduction)

Say you have this code:

void main() {
  Uint8List data = Uint8List(268435456);
  foo(data);
}

void foo(Uint8List data) {
  print("hello data of size ${data.length}");
}

and has a breakpoint on the foo call.

On the left under "Varaibles" you'll see "Uint8List (268435456 items)" and drop-downs breaks it into smaller chunks before eventually it requests 100 elements via a variables call with option "count":100. This works well.

If instead you place your mouse over the data variable in the source code you're in for a bad time because it requests without any "count" parameter and the VM then happily does what it was asked on all 268435456 elements - eventually (on my machine) running out of memory somewhere in return elements.mapIndexed([...]).toList(); in ProtocolConverter.convertVmInstanceToVariablesList.
Until it fails (after a while) debugging is unresponsive, and the debugging session can't even be stopped (without killing the running dart debug_adapter processing).
I suspect that if we had a size that was small enough that it wouldn't cause out-of-memory on the dart side the IDE would be in for a bad time once it had to receive that data. (Okay, I couldn't help myself: Reducing it to 1mio does indeed make the IDE use lots of CPU and lots of memory. There might even be a memory leak - after doing it with 1 mio 5 times (I think - that is start a debugging session, hover, click "continue" and wait until it actually continues, start the 2nd one etc) the memory consumption of the (remote) vs code according to the chrome task manager is now 2.1+ GB...)

Expected behavior
Either it only shows the first x (100?) entries, or (preferably) it would give the same drop-downs as the variables on the left.

Please complete the following information:

Dart Code extension: 3.112.0
Flutter extension: 3.112.0 (not activated)

App: code-server
App Host: server-distro
Remote: 127.0.0.1:49363
Host Kind: server-distro
Version: linux 1.91.1

Workspace type: Dart (LSP)
Workspace name: profiling

Dart (3.9.0-edge): (my checkout)
Flutter (3.29.3): (my checkout)

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis bugrelies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions