[comp.windows.x] Bug in [xterm] translations/keymaps ?

zvr@ntua.gr (Alexios Zavras) (03/18/91)

I have noticed the following behavior in xterm, which I personally
consider a bug, and I would like to get any feedback on this, in
the hope that it would be fixed in R5 (when it comes out).

The problem has to do with the way translations (more specificaly
keymaps) are handled.  I noticed it because I am using the keymap
facility quite extensively.

The problem is that each time there is a keymap change, the size
of the xterm executable is increased by 30 to 40 Kbytes.  Given
the number of changes performed while I am working, it doesn't
take long before I find myself running an xterm of more than
4 Megabytes !!!  Of course, it gets unacceptable pretty quick,
so I have to exit this and start all over a new one...

I assumed, therefore, that xterm, on every request for a keymap
change, allocates a new keymap, without discarding the old one.
I consider this a serious bug.  I believe that xterm should be
modified to keep a list of previously used keymaps and re-use
one of them if possible, instead of allocating a new one.

On the other hand, I just looked at the xterm code, and if my
understanding is correct, and especially function
HandleKeymapChange (file charproc.c, line 2550 or so),
there are only two variables:
>     static XtTranslations keymap, original;

No allocation of new ones, so it is actually not the xterm itself
but the Xt code for translations that has this memory leak.

Can anyone provide any more info on this ?
And, as always, fixes on the code are especially welcome! :-)
-- zvr --
    +---------------------------+	Alexios Zavras (-zvr-)
    | H eytyxia den exei enoxes |	zvr@ntua.gr
    +-----------------------zvr-+	zvr%theseas.ntua.gr@ariadne.csi.forth.gr
"Il faut vivre comme on pense,
 sinon tot ou tard, on finit par penser comme on a vecu"