Memory leak in fedora 8 xorg server 1.3

Barry Scott barry.scott at onelan.co.uk
Tue Dec 23 04:38:29 PST 2008


I'm tracking down a memory leak in xorg server 1.3.

With some work loads we see a reproducible memory leak in the xorg server.

I have got as far as finding that miRegionCreate is being called 46000 
times in 5m and
the memory it allocates is not being freed. There are 17000 blocks 
leaked from
miRectAlloc as well.

Is this a known problem that may be fixed in later code?

I'm going to keep in digging deeper into the code to see what I can find 
out.

I'm using mtrace in glibc to find out what is going on and I have been
patching out Xalloc to avoid everything being reported as allocated
in utils.c.

As an aside there are some odd bits of code that I'd like to understand:

Why does Xalloc need to check for negative size? It casts the unsigned long
size of long and test for < 0.

In miregion.c xfreeData macro: Why do a test on the size?
Doesn't this lead to a leak of a malloc'ed block of memory?

#define xfreeData(reg) if ((reg)->data && (reg)->data->size) 
xfree((reg)->data)

Barry




More information about the xorg mailing list