The Java debugger fails to show locals after a large object is created in the current scope.
Environment
- Operating System: Windows 10 1909 18363.1734 x64
- JDK version: OpenJDK 16.0.2
- Visual Studio Code version: 1.59.1
- Java extension version: 0.81.0
- Java Debugger extension version: 0.35.0
Steps To Reproduce
- Debug a class and set a break point after a line, where a large object is created in the current scope.
SomeClassContainingAMap variable = this.getSomethingWithAVeryLargeMapOfComplexObjectsInside();
Launch Command
> c:; cd 'c:\path\to\folder'; & 'c:\Users\user\.vscode\extensions\vscjava.vscode-java-debug-0.35.0\scripts\launcher.bat' 'C:\jdk-16.0.2\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:53340' '-Xmx24G' '-ea' '-XX:+ShowCodeDetailsInExceptionMessages' '-Dfile.encoding=UTF-8' '@C:\Users\user\AppData\Local\Temp\cp_c5uy9eqnavixxyehhdl84kqui.argfile' 'my.run.class'
Log
WARNING: Using incubator modules: jdk.incubator.foreign, jdk.incubator.vector
[Error - 6:03:17 PM] Aug 27, 2021, 6:03:17 PM [error response][variables]: Java heap space
Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3536)
at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228)
at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:802)
at java.base/java.lang.StringBuilder.append(StringBuilder.java:242)
at org.eclipse.jdi.internal.jdwp.JdwpString.read(JdwpString.java:40)
at org.eclipse.jdi.internal.MirrorImpl.readString(MirrorImpl.java:455)
at org.eclipse.jdi.internal.StringReferenceImpl.value(StringReferenceImpl.java:65)
at com.microsoft.java.debug.core.adapter.formatter.StringObjectFormatter.toString(StringObjectFormatter.java:46)
at com.microsoft.java.debug.core.adapter.variables.VariableFormatter.valueToString(VariableFormatter.java:92)
at com.microsoft.java.debug.core.adapter.variables.VariableDetailUtils.computeToStringValue(VariableDetailUtils.java:89)
at com.microsoft.java.debug.core.adapter.variables.VariableDetailUtils.formatDetailsValue(VariableDetailUtils.java:53)
at com.microsoft.java.debug.core.adapter.handler.VariablesRequestHandler.handle(VariablesRequestHandler.java:286)
at com.microsoft.java.debug.core.adapter.DebugAdapter.lambda$dispatchRequest$0(DebugAdapter.java:89)
at com.microsoft.java.debug.core.adapter.DebugAdapter$$Lambda$641/0x00000008013915a0.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1183)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2305)
at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:88)
at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:118)
at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$new$0(AbstractProtocolServer.java:78)
at com.microsoft.java.debug.core.protocol.AbstractProtocolServer$$Lambda$632/0x000000080137cb70.accept(Unknown Source)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:60)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:200)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
[Error - 6:03:26 PM] Aug 27, 2021, 6:03:26 PM [error response][evaluate]: Java heap space
Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.base/java.util.Arrays.copyOf(Arrays.java:3536)
at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:228)
at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:802)
at java.base/java.lang.StringBuilder.append(StringBuilder.java:242)
at org.eclipse.jdi.internal.jdwp.JdwpString.read(JdwpString.java:40)
at org.eclipse.jdi.internal.MirrorImpl.readString(MirrorImpl.java:455)
at org.eclipse.jdi.internal.StringReferenceImpl.value(StringReferenceImpl.java:65)
at com.microsoft.java.debug.core.adapter.formatter.StringObjectFormatter.toString(StringObjectFormatter.java:46)
at com.microsoft.java.debug.core.adapter.variables.VariableFormatter.valueToString(VariableFormatter.java:92)
at com.microsoft.java.debug.core.adapter.variables.VariableDetailUtils.computeToStringValue(VariableDetailUtils.java:89)
at com.microsoft.java.debug.core.adapter.variables.VariableDetailUtils.formatDetailsValue(VariableDetailUtils.java:53)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:122)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler$$Lambda$723/0x0000000801428ab8.get(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1764)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1756)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[Error - 6:03:29 PM] Aug 27, 2021, 6:03:29 PM [error response][evaluate]: Java heap space
Java heap space
java.lang.OutOfMemoryError: Java heap space
Current Result
With a running debugging session, this is shown on the variables pane of the debugger side bar. Also, no values of variables are shown while hovering over them.

Expected Result
Showing locals and providing variable value hovers should still work even if large objects are created.
Additional Informations
If I'm allowed to speculate here: The log suggests that something is copied which might not be wise with very large objects. Running the class without debugger works totally fine.
Thank you for your work for bringing Java support to VS Code.
The Java debugger fails to show locals after a large object is created in the current scope.
Environment
Steps To Reproduce
Launch Command
Log
Current Result
With a running debugging session, this is shown on the variables pane of the debugger side bar. Also, no values of variables are shown while hovering over them.

Expected Result
Showing locals and providing variable value hovers should still work even if large objects are created.
Additional Informations
If I'm allowed to speculate here: The log suggests that something is copied which might not be wise with very large objects. Running the class without debugger works totally fine.
Thank you for your work for bringing Java support to VS Code.