about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-02-14 15:21:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-02-14 15:21:35 +0000
commit5a52e1ee8096e878f3274f606cbd6fee3fa1dbbe (patch)
tree3ffd5b501e8ef9ff69ae0dc2cf465350c87c2877
parentae7d5b55030ee124e5bf28478264aafde3bfcc64 (diff)
downloadzsh-5a52e1ee8096e878f3274f606cbd6fee3fa1dbbe.tar.gz
zsh-5a52e1ee8096e878f3274f606cbd6fee3fa1dbbe.tar.xz
zsh-5a52e1ee8096e878f3274f606cbd6fee3fa1dbbe.zip
24551: Free heap memory after every ZLE command
-rw-r--r--ChangeLog7
-rw-r--r--Src/Zle/compresult.c1
-rw-r--r--Src/Zle/zle_main.c13
3 files changed, 21 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 41a2210b6..6ae0f492f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-02-14  Peter Stephenson  <pws@csr.com>
+
+	* 24551: Src/Zle/compresult.c, Src/Zle/zle_main.c: free heap
+	memory after each full Zle command executed (plus cosmetics).
+	Still need to try and stop menu selection accumulating heap
+	memory.
+
 2008-02-11  Peter Stephenson  <pws@csr.com>
 
 	* users/12547: Completion/Darwin/Type/_mac_files_for_application,
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 021330ddb..471e7c2c6 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1200,6 +1200,7 @@ do_menucmp(int lst)
 	showinglist = -2;
 	return;
     }
+
     /* Otherwise go to the next match in the array... */
     do {
 	if (!*++(minfo.cur)) {
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index e29b759e9..8df07e7ef 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1000,6 +1000,8 @@ zlecore(void)
     FD_ZERO(&foofd);
 #endif
 
+    pushheap();
+
     /*
      * A widget function may decide to exit the shell.
      * We never exit directly from functions, to allow
@@ -1070,7 +1072,11 @@ zlecore(void)
 #endif
 	    if (!kungetct)
 		zrefresh();
+
+	freeheap();
     }
+
+    popheap();
 }
 
 /* Read a line.  It is returned metafied. */
@@ -1786,12 +1792,19 @@ static struct builtin bintab[] = {
 
 /**/
 mod_export struct hookdef zlehooks[] = {
+    /* LISTMATCHESHOOK */
     HOOKDEF("list_matches", NULL, 0),
+    /* COMPLETEHOOK */
     HOOKDEF("complete", NULL, 0),
+    /* BEFORECOMPLETEHOOK */
     HOOKDEF("before_complete", NULL, 0),
+    /* AFTERCOMPLETEHOOK */
     HOOKDEF("after_complete", NULL, 0),
+    /* ACCEPTCOMPHOOK */
     HOOKDEF("accept_completion", NULL, 0),
+    /* REVERSEMENUHOOK */
     HOOKDEF("reverse_menu", NULL, 0),
+    /* INVALIDATELISTHOOK */
     HOOKDEF("invalidate_list", NULL, 0),
 };