-
Notifications
You must be signed in to change notification settings - Fork 173
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
out of memory error, when typing a char with 18k carets (almost the limit of "undo_max_carets": 20000) #5696
Comments
Confirmed on Linux. I Will investigate it soon. Now my notebook's SSD disk is dying and replacing Will be only next week. Im not in the town. |
I confirm the memory grow (up to 7 Gb for typing at line start with 18k carets) + slow work. |
Why the memory grows so much - because Undo-list design is not compact. for typing 1 char with 18k carets - undo-list contains 18k items and each item contains 18k*4 integers (and other infos). what will help here is redesign of Undo-list internal format. maybe I will look at it later, not sure. Current workaround which I suggest: smaller value of "undo_max_carets". eg 1000. EDIT |
Thanks!. I confirm that with undo_max_carets = 1000, then I can do the edits and they are quite quick. |
Maybe you tested it wrong? As I know that option must work like you guessed... So with 18k carets, option value 16k must also make it fast. |
(Marked as 'enhancement' because there is no bug but I see the room for improvement of too big memory usage) |
I think you're right. I checked again and 10000 for max_undo_carets works with my file. Not sure what happened the first time |
proper fix will be:
this will give O(caret_count) mem usage for Undo. current usage: O(caret_count^2). |
I have a file with approx 18,000 lines, max 20 chars in each line
I do Ctrl A to select all lines
Then Shift Ctrl L to put in multiple carets and hit home key to go to start of lines
Then type a character (to insert the character at all caret positions) - takes about 6 seconds
Then hit 'end' key to move caret to end of lines, then insert another character - takes about 22 seconds
When I type the third character I get "out of memory" error
I did try changing undo_max_carets option to 10000 , but that didn't help
SublimeText does each character in 3 seconds
Windows 10
The text was updated successfully, but these errors were encountered: