zsh-workers
 help / color / mirror / code / Atom feed
From: Zefram <zefram@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu
Subject: memory leak in 3005
Date: Sat, 22 Mar 1997 16:37:00 GMT	[thread overview]
Message-ID: <13357.199703221637@stone.dcs.warwick.ac.uk> (raw)

-----BEGIN PGP SIGNED MESSAGE-----

There is a memory leak when unloading the zle module (patch 3005),
when there are user-defined widgets (patch 3002).

 -zefram

 *** Src/Zle/zle_thingy.c	1997/03/22 01:55:52	1.5
 --- Src/Zle/zle_thingy.c	1997/03/22 13:44:52
 ***************
 *** 52,57 ****
 --- 52,58 ----
   
   static void createthingytab _((void));
   static void emptythingytab _((HashTable));
 + static void scanemptythingies _((HashNode, int));
   static Thingy makethingynode _((void));
   static void freethingynode _((HashNode));
   
 ***************
 *** 84,89 ****
 --- 85,92 ----
       thingytab->printnode   = NULL;
   }
   
 + static LinkList elist;
 + 
   static void
   emptythingytab(HashTable ht)
   {
 ***************
 *** 92,100 ****
        * function would free all the thingies, but we don't want to do  *
        * that because some of them are the known thingies in the fixed  *
        * `thingies' table.  As the module cleanup code deletes all the  *
 !      * keymaps and so on before deleting the thingy table, we can be  *
 !      * sure that *all* the thingies left at this point are the fixed  *
 !      * ones.  Therefore, we don't want to free any of them.           */
   }
   
   static Thingy
 --- 95,124 ----
        * function would free all the thingies, but we don't want to do  *
        * that because some of them are the known thingies in the fixed  *
        * `thingies' table.  As the module cleanup code deletes all the  *
 !      * keymaps and so on before deleting the thingy table, we can     *
 !      * just remove the user-defined widgets and then be sure that     *
 !      * *all* the thingies left are the fixed ones.  This has the side *
 !      * effect of freeing all resources used by user-defined widgets.  */
 !     Thingy t;
 ! 
 !     PERMALLOC {
 ! 	elist = newlinklist();
 ! 	scanhashtable(thingytab, 0, 0, DISABLED, scanemptythingies, 0);
 ! 	while((t = getlinknode(elist)))
 ! 	    unbindwidget(t, 1);
 ! 	zfree(elist, sizeof(*elist));
 !     } LASTALLOC;
 ! }
 ! 
 ! static void
 ! scanemptythingies(HashNode hn, int flags)
 ! {
 !     Thingy t = (Thingy) hn;
 ! 
 !     /* Mustn't unbind internal widgets -- we wouldn't want to free the *
 !      * memory they use.                                                */
 !     if(!(t->widget->flags & WIDGET_INT))
 ! 	addlinknode(elist, t);
   }
   
   static Thingy

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBMzPjhXD/+HJTpU/hAQHBSgQAuz92163WzLUZEIzL6w4b/3T4hF7PTdjI
COIB1s2RZCkQqT8YqvjQsVBg6fkui1Mt1pBvbcgwJixLEPIFNB8DtV+p0I0IJp54
N+VKwLkX23jxERvqAzm0xwZck6jvtPNqFNyd86IsZPZsmtfEeclbQxHrkRPyh4ZR
/cawosFD9bg=
=JJJ+
-----END PGP SIGNATURE-----


                 reply	other threads:[~1997-03-22 16:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13357.199703221637@stone.dcs.warwick.ac.uk \
    --to=zefram@dcs.warwick.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).