Of course the return values is compleatly the opposite of what I just
said... :D

Erik

-----Original Message-----
From: Erik Rydgren [mailto:[EMAIL PROTECTED]]
Sent: den 18 oktober 2001 13:32
To: [EMAIL PROTECTED]
Subject: RE: Memory leak


Hi!

My memory checking tool also reported this but it is actually correct.
The compareAndSwap just does an atomic assignment to a pointer.
So if validatorMutex is 0 it will get the value of tmpMutex and the fuction
returns true.
Or if validatorMutex already was set the function leaves it and returns
false.
Although the validatorMutex is never deleted, however my application doesn't
have any problems with that so I didn't dig any deaper. Xerces leaks ONE
instance of XMLMutex in total. It will not leak one for each Parse.

Regards
Erik Rydgren
Mandarinen systems AB
Seden

-----Original Message-----
From: Williamson, Siehnai [mailto:[EMAIL PROTECTED]]
Sent: den 17 oktober 2001 23:38
To: '[EMAIL PROTECTED]'
Subject: Memory leak


Hi Everyone,
There appears to be a memory leak in the SAX parser during validation.  It
occurs at the line XMLMutex* tmpMutex = new XMLMutex in the
gVAlidatorMutex() method of the XMLValidator class (see below):
*****
static XMLMutex& gValidatorMutex()
{
    static XMLMutex* validatorMutex = 0;
    if (!validatorMutex)
    {
        XMLMutex* tmpMutex = new XMLMutex;
        if (XMLPlatformUtils::compareAndSwap((void**)&validatorMutex,
tmpMutex, 0))
        {
            // Someone beat us to it, so let's clean up ours
            delete tmpMutex;
        }
    }
    return *validatorMutex;
}
*****
tmpMutex appears to never have been deleted if
XMLPlatformUtils::compareAndSwap((void**)&validatorMutex, tmpMutex, 0)
returns 0.  If it is deleted by XMLPlatformUtils, I don't see it.  Please
help.



Siehnai Williamson
DocuCorp International, Inc.
Tel:  (214) 891-6401


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to