[PATCH] Initialize dev privates before using any

Keith Packard keithp at keithp.com
Thu Jul 1 05:25:07 PDT 2010


On Wed, 30 Jun 2010 19:30:51 +0300, Tiago Vignatti <tiago.vignatti at nokia.com> wrote:
> On Wed, Jun 30, 2010 at 05:39:34PM +0200, ext Keith Packard wrote:
> > Initializing the dev privates code after allocating the server client
> > dev privates would cause the memory leak check to fire at server
> > startup or reset.
> > 
> > Signed-off-by: Keith Packard <keithp at keithp.com>
> > ---
> > 
> > This eliminates the memory leak warning which prompted Tiago's change
> > to print those only in debug builds.
> 
> Honestly I don't know about the code around and didn't understand the
> "eliminates the memory leak" that you mentioned.

It's not an actual leak; the devPrivates code tracks the number of
private structures initialized and at dixResetPrivates time, there
aren't supposed to be any active. If there are, that indicates a
probable memory leak.

> 
> Anyway, I tested here your patch. At start up I still seeing this:
> 
> [ 96638.705] 1 XSELINUXs still allocated at reset
> [ 96638.705] TOTAL: 0 objects, 0 bytes, 0 allocs
> [ 96638.706] 1 CLIENTs still allocated at reset
> [ 96638.706] TOTAL: 0 objects, 0 bytes, 0 allocs

At server startup time, this 'shouldn't' be possible -- this indicates
that a ClientRec has had devPrivates initialized before dixResetPrivates
was called. The patch I posted moved the dixResetPrivates call before
dixAllocatePrivates was called to initialize the serverClient
devPrivates structure.

> your patch stills not fix the behaviour that I would like to see: to shut up
> the server log output.

The patch resolves the issue for me; can I get you to make sure you're
running the patched code, and if so, to run the server under gdb with
breakpoints at both dixResetPrivates and dixAllocatePrivates to see how
dixAllocatePrivates is called before dixResetPrivates?

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20100701/96f64de5/attachment.pgp>


More information about the xorg-devel mailing list