I can say for sure that fvwm 2.4.7 is leaking memory per program
window.  I don't think the cvs version 2.5.3 is leaking, but I can't
be completely sure.  I just ran a bunch of xterms and it seemed fine.

I've included a program to ponder, and I'll suggest using Xnest if
anyone wants to run it, or an X session they don't want to use for a
while.

  PID USER     PRI  NI  SIZE SWAP  RSS SHARE STAT %CPU %MEM   TIME COMMAND
23686 david      9   0   856  240  616   616 S     0.0  0.1   0:00 FvwmPager
23677 david      9   0   488  112  376   376 S     0.0  0.1   0:00 FvwmTheme
23653 david      9   0  321M 310M  10M 11060 S     0.0  3.5   2:49 fvwm

The program is simple enough, but here's what it does anyway.
1. open X connection
2. create window
3. destroy window
4. go to #2 n times (I'm using 1000000)
5. close X connection 

I'm just throwing this program out for anyone to look at if they are
interested, I'm not going to look into it myself.  I tried it against
kde maybe I didn't wait long enough (over night) but kde didn't
recover where fvwm fully recovers, although it doesn't give the memory
back to Linux.

On Thu, Jul 11, 2002 at 08:47:37AM +0200, Olivier Chapuis wrote:
> On Tue, Jul 09, 2002 at 12:51:01AM -0500, David Fries wrote:
> > Speaking of memory usage, has anyone thought about looking for some
> > memory leaks?  Ok so I've been a lazy Debian user and I'm not up to
> > what's in CVS (2.4.7 right now), but here's what I'm seeing (from top).
> > 
> >   PID USER     PRI  NI  SIZE SWAP  RSS SHARE STAT %CPU %MEM   TIME COMMAND
> >   668 david      8   0 15300 8948 6352  3440 S     0.0  1.9   3:35 fvwm2
> > after restarting fvwm, same windows etc
> >   668 david     10   0  2468    0 2468  1348 S     0.1  0.7   3:36 fvwm2
> >
> 
> Maybe some part the leaks come from the Xlib. I think that the
> debian package is compiled with --enable-multibyte. There is some memory
> leaks in XCreateFontSet: each time a font is unloaded ~4kb is lost (this
> depends on the font, with an utf8 locale and if you use an iso106464-1
> font with a big coverage this may be a lot more).
> 
> For example:
> - if you delete a window ~4kb is lost (0kb with 2.5.2) 
> - if you change your font and you have 20 windows, ~80kb is
> lost (only 4kb with 2.5.2).
> 
> I've recently sent a patch to the XFree developers but no feedback yet ...
> 
> Note that I do not claim that all the leak come from the Xlib,
> it is just a possibility. So one question and one query:
> - Do you do something special regarding the fvwm config
> (as regularly changing some config parameters)
> - Can you send me your config file(s) if this is possible.
> 
> Regards, Olivier 

-- 
                +---------------------------------+
                |      David Fries                |
                |      [EMAIL PROTECTED]        |
                | http://fries.net/~david/pgp.txt |
                +---------------------------------+
CFLAGS=-g -Wall
LDFLAGS=-L/usr/X11R6/lib -lX11

.PHONY: all

all: wm_killer

clean:
        rm -f wm_killer
/* This program doesn't do much... It also only takes one argument which
 * is the number of times to create and destory a window.  Doesn't sound
 * like much right?  Wrong, some window managers don't seem to respond
 * very well when this program is run against them.  An argument of
 * 500000 causes fvwm to allocate some 160MB of ram, and it takes a few
 * minutes to straighten its self out and be use able again.
 * Please set DISPLAY to the appropiate X session.  I suggest you only
 * run it agains Xnest, If your lost so far, stop, delete this program,
 * be happy.  In that order.
 * -- David Fries <[EMAIL PROTECTED]>
 */

#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int GotError( Display *dpy, XErrorEvent *event)
{
	char buf[10240];
	XGetErrorText( event->display, event->error_code, buf, sizeof(buf));
	fprintf(stderr, "Error received  %s\n", buf);
	exit(1);
	return 0;
}

int main( int argc, char ** argv)
{
	int fromScreen;
	Display * fromDpy;
	Window root;
	Window fromWin;
	int i=0;
	int stop;
	struct timespec req, reqs={0, 50000000};
	XSetWindowAttributes xswa = { 0 };
	if(argc!=2)
	{
		fprintf(stderr, "Wrong # arguments\n");
		return -1;
	}
	stop=atoi(argv[1]);

	XSetErrorHandler( GotError);
	fromDpy = XOpenDisplay( "" );
	if( !fromDpy )
	{
		exit(-1);
	}


	fromScreen = XDefaultScreen(fromDpy);
	/* create a window to use for grabs */
	root = XDefaultRootWindow( fromDpy );
	if( !root )
		return -1;
	xswa.override_redirect = 1;
	for( i=0; i<stop; i++)
	{
	fromWin = XCreateWindow( /*Display*/ fromDpy, /*Parent*/ root,
		/*X*/ 0,/*Y*/ 0,
		/*Width*/ 1,/*Height*/ 1, /*BorderWidth*/ 0,
		/*depth*/ CopyFromParent,
		/*Class*/ InputOutput, /*Visual*/ DefaultVisual(fromDpy,
			fromScreen),
		/*Valuemask*/ 0,//CWBackPixel | CWOverrideRedirect,
		/*XSetWindowAttributes*/ &xswa);
	//SetWindowName(fromDpy, toDpy);
	XMapWindow( fromDpy,fromWin);
	XFlush(fromDpy);
	XDestroyWindow( fromDpy,fromWin);
	XFlush(fromDpy);
	//printf("loop %d\n", i);
	req=reqs;
	nanosleep(&req, 0);
	}
	XCloseDisplay (fromDpy);

	return 0;
}

Attachment: msg00584/pgp00000.pgp
Description: PGP signature

Reply via email to