Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
memory leak in 3005
- X-seq: zsh-workers 3015
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: memory leak in 3005
- Date: Sat, 22 Mar 1997 16:37:00 GMT
-----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-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author