microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.66k stars 28.68k forks source link

Operation would exceed heap memory limits #213356

Open VSCodeTriageBot opened 4 months ago

VSCodeTriageBot commented 4 months ago
Error: Operation would exceed heap memory limits
at V.getLinesContent in src/vs/editor/common/model/textModel.ts:826:10
at new $ in src/vs/workbench/services/textMate/browser/backgroundTokenization/textMateWorkerTokenizerController.ts:78:23
at <anonymous> in src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.ts:68:24
at factory in src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.ts:207:17
at checkAttached in src/vs/workbench/services/textMate/browser/backgroundTokenization/threadedBackgroundTokenizerFactory.ts:215:3
at s.y in src/vs/base/common/event.ts:1156:13
at s.z in src/vs/base/common/event.ts:1167:9
at s.fire in src/vs/base/common/event.ts:1191:9
at V.onBeforeAttached in src/vs/editor/common/model/textModel.ts:565:30
at V.Wb in src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts:1614:30
at V.setModel in src/vs/editor/browser/widget/codeEditor/codeEditorWidget.ts:479:8
at R.setInput in src/vs/workbench/contrib/files/browser/editors/textFileEditor.ts:129:12
at async n.S in src/vs/workbench/browser/parts/editor/editorPanes.ts:434:4
at async n.L in src/vs/workbench/browser/parts/editor/editorPanes.ts:254:34
at async n.openEditor in src/vs/workbench/browser/parts/editor/editorPanes.ts:131:11
at async in src/vs/workbench/browser/parts/editor/editorGroupView.ts:1188:49

Go to Errors Site

hediet commented 3 months ago

I guess we should not call getLinesContent for documents of excessive size

rebornix commented 3 months ago

It throws this error when the file is > 256MB, I wonder if tokenization should already be disabled for files in such size.

On the other hand, maybe we can also have the piece tree buffer in the worker so we can send the chunks over other than sending lines: string[].

aiday-mar commented 2 months ago

Error received around several 1000 of times on 1.91. Corresponding issue will be triaged.