[vim/vim] Error detected while processing function - E363: pattern uses more memory than 'maxmempattern' (#6777)

283 views
Skip to first unread message

Robert van Engelen

unread,
Aug 22, 2020, 1:11:28 PM8/22/20
to vim/vim, Subscribed

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:
Email me at engelen @ acm.org to get the README.md file.

  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.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Christian Brabandt

unread,
Aug 22, 2020, 2:23:00 PM8/22/20
to vim/vim, Subscribed

Does it happen in vim? Please try latest version and say how to reproduce starting from vim --clean

> Am 22.08.2020 um 19:11 schrieb Robert van Engelen <notifi...@github.com>:
>
> 

> 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:
> Email me at engelen @ acm.org to get the README.md file.
>
> Run open -a MacVim README.md
> Type a o (open line) then The char[ at line 2734
> The error is produced and Vim malfunctions from there on
> Screenshots
>
>

Robert van Engelen

unread,
Aug 22, 2020, 4:00:34 PM8/22/20
to vim/vim, Subscribed

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.

Robert van Engelen

unread,
Aug 22, 2020, 4:01:43 PM8/22/20
to vim/vim, Subscribed

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

Robert van Engelen

unread,
Aug 22, 2020, 4:04:04 PM8/22/20
to vim/vim, Subscribed

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

Christian Brabandt

unread,
Aug 24, 2020, 3:26:37 AM8/24/20
to vim/vim, Subscribed

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.

Robert van Engelen

unread,
Aug 25, 2020, 9:52:31 AM8/25/20
to vim/vim, Subscribed

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

An error message is flashed briefly on screen.

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

Attached is the README.md file.

Hope this helps to fix the problem.

- Robert


> On Aug 24, 2020, at 3:26 AM, Christian Brabandt <notifi...@github.com> wrote:
>
>
> 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.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub <https://github.com/vim/vim/issues/6777#issuecomment-678957466>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADECPI5WHU6LT6IKYO7KDLDSCIIY7ANCNFSM4QIGBDJA>.

Christian Brabandt

unread,
Aug 26, 2020, 8:21:04 AM8/26/20
to vim/vim, Subscribed

Attached is the README.md file.

I do not see it

Robert van Engelen

unread,
Aug 26, 2020, 8:31:37 AM8/26/20
to vim/vim, Subscribed

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.

Robert van Engelen

unread,
Aug 31, 2020, 9:11:41 PM8/31/20
to vim/vim, Subscribed

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

K.Takata

unread,
Sep 1, 2020, 7:16:11 AM9/1/20
to vim/vim, Subscribed

It seems that this line triggers the error:
https://github.com/vim/vim/blob/2f1228463aa9ff62814f9732561b1849e5f01f75/runtime/syntax/markdown.vim#L82

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

unread,
Sep 7, 2020, 11:07:10 PM9/7/20
to vim/vim, Subscribed

Cc: @tpope

Tim Pope

unread,
Sep 7, 2020, 11:43:31 PM9/7/20
to vim/vim, Subscribed

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

Christian Brabandt

unread,
Dec 30, 2021, 4:10:24 AM12/30/21
to vim/vim, Subscribed

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


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/6777/1002936966@github.com>

Christian Brabandt

unread,
Dec 30, 2021, 4:10:25 AM12/30/21
to vim/vim, Subscribed

Closed #6777.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/6777/issue_event/5827240397@github.com>

Reply all
Reply to author
Forward
0 new messages