popup-el icon indicating copy to clipboard operation
popup-el copied to clipboard

avoid freeze from big cascade menu

Open aki2o opened this issue 10 years ago • 5 comments

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 avatar Feb 07 '14 17:02 aki2o

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.

aki2o avatar Feb 07 '14 18:02 aki2o

Please wait until I understand this patch.

syohex avatar Feb 08 '14 01:02 syohex

Sorry very too late reply.

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

よろしくお願いします.

syohex avatar Mar 28 '14 16:03 syohex

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

拙作の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

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

aki2o avatar Mar 28 '14 17:03 aki2o

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

jcs090218 avatar Jun 01 '20 09:06 jcs090218