On Tue 27 Sep 2005 at 20:23:46 +0300, Nadav Har'El wrote:
> On Tue, Sep 27, 2005, Olaf Seibert wrote about "[ctwm] Re: ctwm memory 
> leaks?":
> > I attached a patch that I whipped together while I should have gone to
> > sleep. Can you test it?
> 
> It looks to me like this indeed got rid of the icon name leak. Great.
> Thanks.

That is good to hear. Especially, since I looked some more and it seemed
like it should make no difference!

Let me expand a bit on that, maybe somebody can find a solution for the
puzzle.

My initial theory was: "Here is a pointer that should be freed with
free(3) but instead is freed with XFree(3X11). Not only is that
conceptually wrong, it could even just Not Work. For instance, XFree()
could have some administration of memory that it knows about, and ignore
requests to free other memory. Result: a leak."

However today I looked into the implementation of XFree(), at least one
that I had on hand. And it does nothing more than call free(). So there
went my theory, I thought. I did a small test (after my change) with
just a few xterm windows open and closed, and there it correctly freed
the titles, as far as I could see.

There is one possibility that I can think of: that in your version it
does behave like my theory. It seems that my version is XFree86 4.5.0
(or derived from it). What's your X version?

> An unexpected suprise, though, was, that it seems to have also got rid of
> two other leaks that I reported: the window name leak, and also the leak of
> the ColormapWindow pointers. Could it be that your patch had the pleasent
> side-effect of also cleaning those two leaks? Does this make any sense?
> (or maybe I'm doing something wrong in my tests now...).

The first, I am not surprised about. It turns out the window name is freed
in the same way as the icon name. (In fact there are 2 versions of the
window name, that always seem to be the same, as far as I can see, but
sometimes one is used and sometimes the other. If I really can't find a
difference between the two, I'll simplify that.)

The ColormapWindow pointers though - I didn't expect anything like that.
I had not even started looking at them. Maybe I'll do that, just to see
if I can think of some explanation :-)

> The fourth leaks that I reported, of highlight images (20 bytes per new
> window), remains.

I'll look at them now.

> Nadav Har'El                        |       Tuesday, Sep 27 2005, 24 Elul 5765
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.

Reply via email to