slynch8 / 10x

10x IDE/Editor
193 stars 35 forks source link

Crash after attempt to parse 900mb of C big arrays #2689

Open tomaszte opened 4 months ago

tomaszte commented 4 months ago

I accidentally added a lot of 20mb files, 900mb total, to 10x project. (same kind as in https://github.com/slynch8/10x/issues/1883 just much more). 10x becomes unresponsive after few secs, maxing memory usage and often cpu. Eventually it starts to slow down pc and crash programs, background music is tearing etc. eventually 10x itself crashes. I reproduced it on fresh project. My pc has 16gb ram.

edit:I don't know what's possible, but maybe add warning like in vscode that file is too big and won't be parsed? That much C tables do not make sense in codebase anyway(I think :)).

slynch8 commented 4 months ago

There is already a setting for that (ParserMaxFileSize), but it's set at 50MB It might be that the files contain something the parser doesn't like. Could you share one of the files, or create a similar file to test?

tomaszte commented 4 months ago

The files are headers with flat array of bytes, those arrays look like that: static unsigned char ATLAS_BOW01_01_DATA[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, (...) I created them via ExportImageAsCode from https://www.raylib.com/cheatsheet/cheatsheet.html sample 20mb file: ATLAS_fbas_00undr_cloak2plain_00b.zip

I just opened that single file with 10x_notepad, and it maxed my cpu and memory.

slynch8 commented 4 months ago

Thanks very much, that's really helpful.