Skip to content

Conversation

@aki2o
Copy link
Contributor

@aki2o aki2o commented Feb 7, 2014

When do popup-cascade-menu using big list,
I encountered the freeze and memory consumption increase of Emacs.
And the following message was shown.

Emergency (alloc): Warning: past 85% of memory limit

Then, I've been able to avoid it by the following change.

  • The sublist, which is the child list of current menu item, is not stored into text-property.
  • The original index of the menu item is stored into text-property for finding the cascade index of current menu.

In addition, I think the sublist slot of popup-menu* should be deprecated.
So, I've appended the comment about it.

Best regards.


英語が不得手なので、日本語で一応補足します。

popup-cascade-menuを使わせて頂いているのですが、巨大なカスケードメニューを作ってみた所、
子メニューを辿ったり、スクロールしたり、C-gで終了しようとした時に、Emacsがフリーズし、使用メモリ量が急上昇します。

現在は、カスケードされる子メニューのリストを親メニュー要素のテキストプロパティで保持していますが、
それをpopup-menu-event-loopに引数で渡すようにすることで解決できました。
ただ、isearchで絞り込んだ場合、親メニュー要素の本来の順番が不明になり、
対応する子メニューが判別できなくなってしまうため、各メニュー要素に本来の順番をテキストプロパティで保持するようにしました。

あと、sublistスロットは今後使うべきでないと思うので、その旨のコメントを加えました。

現在、popup.elを使った拡張を作っているのですが、フリーズしてしまうのは何とかして避けたいです。
どうぞ宜しくお願い致します。

@aki2o
Copy link
Contributor Author

aki2o commented Feb 7, 2014

I provide the test for this trouble.
Eval the sexp in the following URL.

https://gist.github.com/aki2o/3311aad5cd533fc21c8a

In my environment,
I've checked the freeze was happen by the above data and it was resolved by my change.

@syohex
Copy link
Contributor

syohex commented Feb 8, 2014

Please wait until I understand this patch.

popup.el Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better following code than this ?

(cl-loop for e in list
         for idx = 0 then (1+ idx)
         collect (popup-make-item e :rawindex idx))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that syntax, thanks.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be even simpler:

(cl-loop for e in list
         for idx from 0
         collect (popup-make-item e :rawindex idx))

@syohex
Copy link
Contributor

syohex commented Mar 28, 2014

Sorry very too late reply.

freezeするというサンプルと, いろいろ試してみたのですが, フリーズしたり
メモリ量が極端に増えたりというのが見られませんでした.(Emacs 24.1, 24.2, 24.3 開発版).
これは必要最低限の設定でも再現するものなのでしょうか ? よろしければ問題が発生する
環境について教えていただけないでしょうか ? もしくはもっと極端な例を提示していただく
ことでも構いません.

よろしくお願いします.

@aki2o
Copy link
Contributor Author

aki2o commented Mar 28, 2014

返信ありがとうございます。
サンプルはテキストプロパティが反映されてなくて不完全でした。。
誤った情報でお時間を浪費させてしまい、大変申し訳ありません。

拙作のctxmenu.elを使って試して頂くことは可能でしょうか?
package.elなどでインストール可能です。
インストール後、

(require 'ctxmenu-config)
(ctxmenu-config:setup)

を評価し、M-xctxmenu:showでメニューが表示されるはずですので、項目が多いメニュー(EmacsHelpあたり)の配下で試して頂きたく。

私の以下の環境では、上記で発生します。
GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600) of 2012-12-08 on GNUPACK

お手数ですが、どうぞ宜しくお願い致します。

@jcs090218
Copy link
Member

Okay, I don't know Japanese. I might need some help here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants