Skip to content
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

Error detected while processing function - E363: pattern uses more memory than 'maxmempattern' #6777

Closed
genivia-inc opened this issue Aug 22, 2020 · 13 comments
Labels

Comments

@genivia-inc
Copy link

genivia-inc commented Aug 22, 2020

Describe the bug

Error detected while processing function <SNR>16_Highlight_Matching_Pair:
line  107:
E363: pattern uses more memory than 'maxmempattern'

From there on MacVim is unstable.

To Reproduce
Detailed steps to reproduce the behavior:

  1. Run open -a MacVim README.md
  2. Type a o (open line) then The char[ at line 2734
  3. The error is produced and Vim malfunctions from there on

Screenshots
image

Environment (please complete the following information):

  • Vim version 8.2.539 (163) GUI
  • OS: macOS 10.12.6

Additional context
Other glitches have been plaguing MacVim for months after updating, so I stopped updating since it only got worse. It used to be stable. Now sometimes lines are missing in the middle of the view when navigating with { and } (CTRL-L makes them reappear). Syntax highlighting is glitchy, sometimes lagging behind the movements. Please stop adding new features that we don't need and fix what used to work. Thanks.

@chrisbra
Copy link
Member

chrisbra commented Aug 22, 2020 via email

@genivia-inc
Copy link
Author

Thanks for the quick reply. I tried the latest MacVim 8.2.1456 (165). Same problem.

Also non-GUI Vim 8.2 in a terminal has the same issue (I've used brew install vim):
image

Now, when I try a to edit the line after the [ this fails as text is inserted before the [, not after. Also the syntax highlighting is gone, so I suspect that is causing the glitches. Because editing the line fails, I close Vim as I don't trust that what I see is what the file contains.

This issue does not happen with my old Vim 7.4.

@genivia-inc
Copy link
Author

My .vimrc settings (part of):

" Common options
set spelllang=en_us
" set spell
set nocp
set encoding=utf8
set ruler
set hlsearch
set scrolljump=4
set autoindent shiftwidth=2
set smarttab
set expandtab
set cindent
set ignorecase smartcase
" set cinwords=case,default,do,else,for,if,private,protected,public,switch,while
syntax on
" color DarkBlue
" highligh Normal guibg=Black
highlight LineNr guifg=Blue
highlight CursorLine guibg=bg
highlight CursorLineNr guifg=DarkYellow
autocmd BufNewFile,BufFilePre,BufRead *.md set filetype=markdown
autocmd BufNewFile,BufFilePre,BufRead *.bas set filetype=vb

@genivia-inc
Copy link
Author

I forgot the mention that vim --clean also glitches. The error message disappears but the results are the same.

@chrisbra
Copy link
Member

I forgot the mention that vim --clean also glitches. The error message disappears but the results are the same.

I am not sure what you mean by 'glitches', but by default I think the matchparen plugin is not loaded in such a case.

If you could share the README, I'd like to have a look. Thanks.

@genivia-inc
Copy link
Author

genivia-inc commented Aug 25, 2020 via email

@chrisbra
Copy link
Member

Attached is the README.md file.

I do not see it

@genivia-inc
Copy link
Author

Please contact me at the email address that I had suggested in my post (but now removed from public view). I also uploaded a copy here.

@genivia-inc
Copy link
Author

Were you able to download the README file from the URL?

@k-takata
Copy link
Member

k-takata commented Sep 1, 2020

It seems that this line triggers the error:

syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart

The cost of this pattern (!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=) seems high.
Loop unrolling (described in the book "Mastering Regular Expressions") might mitigate the error.
So, how about this?

--- a/runtime/syntax/markdown.vim
+++ b/runtime/syntax/markdown.vim
@@ -79,7 +79,7 @@ syn region markdownUrlTitle matchgroup=m
 syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+'+ end=+'+ keepend contained
 syn region markdownUrlTitle matchgroup=markdownUrlTitleDelimiter start=+(+ end=+)+ keepend contained
 
-syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\%(\_[^][]\|\[\_[^][]*\]\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
+syn region markdownLinkText matchgroup=markdownLinkTextDelimiter start="!\=\[\%(\_[^][]*\%(\[\_[^][]*\]\_[^][]*\)*]\%( \=[[(]\)\)\@=" end="\]\%( \=[[(]\)\@=" nextgroup=markdownLink,markdownId skipwhite contains=@markdownInline,markdownLineStart
 syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" contains=markdownUrl keepend contained
 syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained
 syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline

@k-takata
Copy link
Member

k-takata commented Sep 8, 2020

Cc: @tpope

@tpope
Copy link
Contributor

tpope commented Sep 8, 2020

Works for me, I'll add to my copy.

@chrisbra
Copy link
Member

It looks like this problem has been successfully addressed by a patch from @k-takata and @tpope so let me close this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants