You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/05/22 04:26:53 UTC

cvs commit: xml-xerces/c/src/xercesc/dom/deprecated AttrImpl.cpp AttrMapImpl.cpp AttrNSImpl.cpp CDATASectionImpl.cpp CommentImpl.cpp DOMParser.cpp DOMParser.hpp DOMString.cpp DOMString.hpp DOM_DOMImplementation.cpp DOM_DOMImplementation.hpp DOM_Document.cpp DOM_Document.hpp DStringPool.cpp DStringPool.hpp DeepNodeListImpl.cpp DocumentFragmentImpl.cpp DocumentImpl.cpp DocumentImpl.hpp ElementDefinitionImpl.cpp ElementImpl.cpp ElementNSImpl.cpp EntityImpl.cpp EntityReferenceImpl.cpp NamedNodeMapImpl.cpp NodeIDMap.cpp NodeIDMap.hpp NodeIteratorImpl.hpp NodeVector.cpp NodeVector.hpp TextImpl.cpp XMLDeclImpl.cpp

knoaman     2003/05/21 19:26:53

  Modified:    c/src/xercesc/dom/deprecated AttrImpl.cpp AttrMapImpl.cpp
                        AttrNSImpl.cpp CDATASectionImpl.cpp CommentImpl.cpp
                        DOMParser.cpp DOMParser.hpp DOMString.cpp
                        DOMString.hpp DOM_DOMImplementation.cpp
                        DOM_DOMImplementation.hpp DOM_Document.cpp
                        DOM_Document.hpp DStringPool.cpp DStringPool.hpp
                        DeepNodeListImpl.cpp DocumentFragmentImpl.cpp
                        DocumentImpl.cpp DocumentImpl.hpp
                        ElementDefinitionImpl.cpp ElementImpl.cpp
                        ElementNSImpl.cpp EntityImpl.cpp
                        EntityReferenceImpl.cpp NamedNodeMapImpl.cpp
                        NodeIDMap.cpp NodeIDMap.hpp NodeIteratorImpl.hpp
                        NodeVector.cpp NodeVector.hpp TextImpl.cpp
                        XMLDeclImpl.cpp
  Log:
  Apply memory manager to deprecated dom.
  
  Revision  Changes    Path
  1.5       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/AttrImpl.cpp
  
  Index: AttrImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/AttrImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AttrImpl.cpp	29 Jan 2003 16:22:57 -0000	1.4
  +++ AttrImpl.cpp	22 May 2003 02:26:49 -0000	1.5
  @@ -170,7 +170,7 @@
   
   NodeImpl * AttrImpl::cloneNode(bool deep)
   {
  -    return new AttrImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) AttrImpl(*this, deep);
   };
   
   
  
  
  
  1.4       +3 -2      xml-xerces/c/src/xercesc/dom/deprecated/AttrMapImpl.cpp
  
  Index: AttrMapImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/AttrMapImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttrMapImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ AttrMapImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -63,6 +63,7 @@
   #include "NamedNodeMapImpl.hpp"
   #include "NodeImpl.hpp"
   #include "ElementImpl.hpp"
  +#include "DocumentImpl.hpp"
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -93,7 +94,7 @@
   
   AttrMapImpl *AttrMapImpl::cloneAttrMap(NodeImpl *ownerNode_p)
   {
  -	AttrMapImpl *newmap = new AttrMapImpl(ownerNode_p);
  +	AttrMapImpl *newmap = new (ownerNode_p->getDocument()->getMemoryManager()) AttrMapImpl(ownerNode_p);
   	newmap->cloneContent(this);
   	newmap->attrDefaults = this->attrDefaults;
   	return newmap;
  
  
  
  1.5       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/AttrNSImpl.cpp
  
  Index: AttrNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/AttrNSImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AttrNSImpl.cpp	20 Dec 2002 22:10:57 -0000	1.4
  +++ AttrNSImpl.cpp	22 May 2003 02:26:50 -0000	1.5
  @@ -117,7 +117,7 @@
   
   NodeImpl * AttrNSImpl::cloneNode(bool deep)
   {
  -    return new AttrNSImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) AttrNSImpl(*this, deep);
   };
   
   DOMString AttrNSImpl::getNamespaceURI()
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/CDATASectionImpl.cpp
  
  Index: CDATASectionImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/CDATASectionImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CDATASectionImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ CDATASectionImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -89,7 +89,7 @@
   
   NodeImpl  *CDATASectionImpl::cloneNode(bool deep)
   {
  -    return new CDATASectionImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) CDATASectionImpl(*this, deep);
   };
   
   
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/CommentImpl.cpp
  
  Index: CommentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/CommentImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CommentImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ CommentImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -97,7 +97,7 @@
   
   NodeImpl * CommentImpl::cloneNode(bool deep)
   {
  -    return new CommentImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) CommentImpl(*this, deep);
   };
   
   
  
  
  
  1.18      +6 -6      xml-xerces/c/src/xercesc/dom/deprecated/DOMParser.cpp
  
  Index: DOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOMParser.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DOMParser.cpp	18 May 2003 14:02:03 -0000	1.17
  +++ DOMParser.cpp	22 May 2003 02:26:50 -0000	1.18
  @@ -173,7 +173,7 @@
       //  will cause the old one to go away unless application code is also
       //  holding a reference to it.
       //
  -    fDocument = DOM_Document::createDocument();
  +    fDocument = DOM_Document::createDocument(fMemoryManager);
       resetDocType();
   
       fCurrentParent   = 0;
  @@ -782,7 +782,7 @@
               if (oneAttrib->getType()==XMLAttDef::ID)
               {
                   if (docImpl->fNodeIDMap == 0)
  -                    docImpl->fNodeIDMap = new NodeIDMap(500);
  +                    docImpl->fNodeIDMap = new (fMemoryManager) NodeIDMap(500, fMemoryManager);
                   docImpl->fNodeIDMap->add(attr);
                   attr->isIdAttr(true);
               }
  @@ -804,7 +804,7 @@
               if (oneAttrib->getType()==XMLAttDef::ID)
               {
                   if (docImpl->fNodeIDMap == 0)
  -                    docImpl->fNodeIDMap = new NodeIDMap(500);
  +                    docImpl->fNodeIDMap = new (fMemoryManager) NodeIDMap(500, fMemoryManager);
                   docImpl->fNodeIDMap->add(attr);
                   attr->isIdAttr(true);
               }
  @@ -1166,7 +1166,7 @@
                               buf.append(XMLUni::fgXMLNSURIName);
                       }
   
  -                    insertAttr = new AttrNSImpl((DocumentImpl*)fDocument.fImpl,
  +                    insertAttr = new (fMemoryManager) AttrNSImpl((DocumentImpl*)fDocument.fImpl,
                          DOMString(buf.getRawBuffer()),     // NameSpaceURI
                          qualifiedName);   // qualified name
   
  @@ -1174,7 +1174,7 @@
                   else
                   {
                       // Namespaces is turned off...
  -                    insertAttr = new AttrImpl((DocumentImpl*)fDocument.fImpl, attr->getFullName());
  +                    insertAttr = new (fMemoryManager) AttrImpl((DocumentImpl*)fDocument.fImpl, attr->getFullName());
                   }
                   insertAttr->setValue(attr->getValue());
                   // memory leak here
  
  
  
  1.18      +2 -1      xml-xerces/c/src/xercesc/dom/deprecated/DOMParser.hpp
  
  Index: DOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOMParser.hpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DOMParser.hpp	15 May 2003 18:25:53 -0000	1.17
  +++ DOMParser.hpp	22 May 2003 02:26:50 -0000	1.18
  @@ -99,6 +99,7 @@
       , public XMLErrorReporter
       , public XMLEntityHandler
       , public DocTypeHandler
  +    , public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  
  
  
  1.7       +89 -8     xml-xerces/c/src/xercesc/dom/deprecated/DOMString.cpp
  
  Index: DOMString.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOMString.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DOMString.cpp	9 Mar 2003 16:37:11 -0000	1.6
  +++ DOMString.cpp	22 May 2003 02:26:50 -0000	1.7
  @@ -155,7 +155,7 @@
       {
           fBufferLength = 0xcccc;
           fRefCount     = 0xcccc;
  -        delete [] this;  //  was allocated with new char[size] !
  +        XMLPlatformUtils::fgMemoryManager->deallocate(this);//delete [] this;  //  was allocated with new char[size] !
           XMLPlatformUtils::atomicDecrement(DOMString::gLiveStringDataCount);
       };
   };
  @@ -174,7 +174,10 @@
                                                  //  array in DOMStringData struct.
       DOMStringData *buf = 0;
       try {
  -        buf = (DOMStringData *) new char[sizeToAllocate];
  +        buf = (DOMStringData *) XMLPlatformUtils::fgMemoryManager->allocate
  +        (
  +            sizeToAllocate * sizeof(char)
  +        );//new char[sizeToAllocate];
       }
       catch (...) {
           ThrowXML(RuntimeException, XMLExcepts::Out_Of_Memory);
  @@ -250,8 +253,11 @@
           // Allocate a new batch of them, using the system's
           // operator new to get a chunk of memory.
           //
  -       DOMStringHandle *dsg =
  -            ::new DOMStringHandle[allocGroupSize];
  +        DOMStringHandle *dsg = (DOMStringHandle*)
  +            XMLPlatformUtils::fgMemoryManager->allocate
  +            (
  +                allocGroupSize * sizeof(DOMStringHandle)
  +            );//::new DOMStringHandle[allocGroupSize];
   
           // Link the block itself into the list of blocks.  The purpose of this is to
           //   let us locate and delete the blocks when shutting down.
  @@ -297,7 +303,7 @@
           for (pThisBlock = blockListPtr; pThisBlock != 0; pThisBlock = pNextBlock)
           {
               pNextBlock = *(DOMStringHandle **)pThisBlock;
  -            delete [] pThisBlock;
  +            XMLPlatformUtils::fgMemoryManager->deallocate(pThisBlock);//delete [] pThisBlock;
           }
           blockListPtr = 0;
           freeListPtr  = 0;
  @@ -912,10 +918,10 @@
       if (len > 0)
       {
           // Transcode from Unicode to char * in whatever the system local code page is.
  -        char *pc = transcode();
  +        char *pc = transcode(XMLPlatformUtils::fgMemoryManager);
           fputs(pc, stdout);
   
  -        delete [] pc;
  +        XMLPlatformUtils::fgMemoryManager->deallocate(pc);//delete [] pc;
       }
   };
   
  @@ -1003,6 +1009,81 @@
           }
       }
       delete [] allocatedBuf;   // which will be null if we didn't allocate one.
  +
  +    // Cap it off and return it
  +    retP[charsNeeded] = 0;
  +    return retP;
  +}
  +
  +char *DOMString::transcode(MemoryManager* const manager) const
  +{
  +    if (!fHandle || fHandle->fLength == 0)
  +    {
  +        char* retP = (char*) manager->allocate(sizeof(char));//new char[1];
  +        *retP = 0;
  +        return retP;
  +    }
  +
  +    // We've got some data
  +    // DOMStrings are not always null terminated, so we may need to
  +    // copy to another buffer first in order to null terminate it for
  +    // use as input to the transcoding routines..
  +    //
  +    XMLCh* DOMStrData = fHandle->fDSData->fData;
  +
  +    const unsigned int localBufLen = 1000;
  +    XMLCh localBuf[localBufLen];
  +    XMLCh *allocatedBuf = 0;
  +    XMLCh *srcP;
  +
  +    if (DOMStrData[fHandle->fLength] == 0)
  +    {
  +        // The data in the DOMString itself happens to be null terminated.
  +        //  Just use it in place.
  +        srcP = DOMStrData;
  +    }
  +    else if (fHandle->fLength < localBufLen-1)
  +    {
  +        // The data is not null terminated, but does fit in the
  +        //  local buffer (fast allocation).  Copy it over, and add
  +        //  the null termination,
  +        memcpy(localBuf, DOMStrData, fHandle->fLength * sizeof(XMLCh));
  +        srcP = localBuf;
  +        srcP[fHandle->fLength] = 0;
  +    }
  +    else
  +    {
  +        // The data is too big for the local buffer.  Heap allocate one.
  +        allocatedBuf = srcP = (XMLCh*) manager->allocate
  +        (
  +            (fHandle->fLength + 1) * sizeof(XMLCh)
  +        );//new XMLCh[fHandle->fLength + 1];
  +        memcpy(allocatedBuf, DOMStrData, fHandle->fLength * sizeof(XMLCh));
  +        srcP[fHandle->fLength] = 0;
  +    }
  +
  +    //
  +    //  Find out how many output chars we need and allocate a buffer big enough
  +    //  for that plus a null.
  +    //
  +    //  The charsNeeded normally is same as fHandle->fLength.  To enhance performance,
  +    //  we start with this estimate, and if overflow, then call calcRequiredSize for actual size
  +    unsigned int charsNeeded = fHandle->fLength;
  +    char* retP = (char*) manager->allocate((charsNeeded + 1) * sizeof(char));//new char[charsNeeded + 1];
  +
  +    if (!getDomConverter()->transcode(srcP, retP, charsNeeded) || (XMLString::stringLen(retP) != charsNeeded))
  +    {
  +        manager->deallocate(retP);//delete [] retP;
  +        charsNeeded = getDomConverter()->calcRequiredSize(srcP);
  +        retP = (char*) manager->allocate((charsNeeded + 1) * sizeof(char));//new char[charsNeeded + 1];
  +        if (!getDomConverter()->transcode(srcP, retP, charsNeeded))
  +        {
  +            // <TBD> We should throw something here?
  +        }
  +    }
  +
  +    if (allocatedBuf)
  +	    manager->deallocate(allocatedBuf);//delete [] allocatedBuf;   // which will be null if we didn't allocate one.
   
       // Cap it off and return it
       retP[charsNeeded] = 0;
  
  
  
  1.5       +19 -1     xml-xerces/c/src/xercesc/dom/deprecated/DOMString.hpp
  
  Index: DOMString.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOMString.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOMString.hpp	15 May 2003 18:25:53 -0000	1.4
  +++ DOMString.hpp	22 May 2003 02:26:50 -0000	1.5
  @@ -320,10 +320,28 @@
         * caller owns the (char *) string that is returned, and is responsible
         * for deleting it.
         *
  +      * Note: The buffer returned is allocated using the global operator new
  +      *       and users need to make sure to use the corresponding delete [].
  +      *       This method will be deprecated in later versions, as we move
  +      *       towards using a memory manager for allocation and deallocation.
  +      *
         * @return A pointer to a newly allocated buffer of char elements, which
         *         represents the original string, but in the local encoding.
         */
       char        *transcode() const;
  +
  +    /**
  +      * Returns a copy of the string, transcoded to the local code page. The
  +      * caller owns the (char *) string that is returned, and is responsible
  +      * for deleting it.
  +      *
  +      * @param  manager the memory manager to use for allocating returned
  +      *         returned buffer.
  +      *
  +      * @return A pointer to a newly allocated buffer of char elements, which
  +      *         represents the original string, but in the local encoding.
  +      */
  +    char        *transcode(MemoryManager* const manager) const;
   
   
       /**
  
  
  
  1.5       +4 -4      xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp
  
  Index: DOM_DOMImplementation.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DOM_DOMImplementation.cpp	20 Dec 2002 22:10:57 -0000	1.4
  +++ DOM_DOMImplementation.cpp	22 May 2003 02:26:50 -0000	1.5
  @@ -217,10 +217,10 @@
   }
   
   DOM_Document DOM_DOMImplementation::createDocument(const DOMString &namespaceURI,
  -	const DOMString &qualifiedName, const DOM_DocumentType &doctype)
  +	const DOMString &qualifiedName, const DOM_DocumentType &doctype, MemoryManager* const manager)
   {
  -    return DOM_Document(new DocumentImpl(namespaceURI, qualifiedName,
  -	doctype == null ? null : (DocumentTypeImpl *) doctype.fImpl));
  +    return DOM_Document(new (manager) DocumentImpl(namespaceURI, qualifiedName,
  +	doctype == null ? null : (DocumentTypeImpl *) doctype.fImpl, manager));
   }
   
   // -----------------------------------------------------------------------
  
  
  
  1.4       +4 -3      xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.hpp
  
  Index: DOM_DOMImplementation.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOM_DOMImplementation.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOM_DOMImplementation.hpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DOM_DOMImplementation.hpp	22 May 2003 02:26:50 -0000	1.4
  @@ -61,7 +61,7 @@
   #ifndef DOM_DOMImplementation_HEADER_GUARD_
   #define DOM_DOMImplementation_HEADER_GUARD_
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   #include "DOMString.hpp"
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -189,7 +189,8 @@
        *   been used with a different document.
        */
       DOM_Document createDocument(const DOMString &namespaceURI,
  -	const DOMString &qualifiedName, const DOM_DocumentType &doctype);
  +	const DOMString &qualifiedName, const DOM_DocumentType &doctype,
  +	MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       //@}
   
       // -----------------------------------------------------------------------
  
  
  
  1.4       +3 -3      xml-xerces/c/src/xercesc/dom/deprecated/DOM_Document.cpp
  
  Index: DOM_Document.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOM_Document.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOM_Document.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DOM_Document.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -102,9 +102,9 @@
   };
   
   
  -DOM_Document    DOM_Document::createDocument()
  +DOM_Document    DOM_Document::createDocument(MemoryManager* const manager)
   {
  -        return DOM_Document(new DocumentImpl);
  +        return DOM_Document(new (manager) DocumentImpl(manager));
   };
   
   
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/DOM_Document.hpp
  
  Index: DOM_Document.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DOM_Document.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DOM_Document.hpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DOM_Document.hpp	22 May 2003 02:26:50 -0000	1.4
  @@ -181,7 +181,7 @@
       *   @return A new <code>DOM_Document</code>, which may then
       *   be populated using the DOM API calls.
       */
  -    static DOM_Document   createDocument();
  +    static DOM_Document   createDocument(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
   
       /**
       *  Create a new entity.
  
  
  
  1.4       +12 -7     xml-xerces/c/src/xercesc/dom/deprecated/DStringPool.cpp
  
  Index: DStringPool.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DStringPool.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DStringPool.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DStringPool.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -76,7 +76,7 @@
   //                      hash table array itself is a pointer to the head
   //                      of a singly-linked list of these structs.
   //
  -struct DStringPoolEntry
  +struct DStringPoolEntry : public XMemory
   {
       DStringPoolEntry    *fNext;
       DOMString           fString;
  @@ -84,10 +84,15 @@
   
   
   
  -DStringPool::DStringPool(int hashTableSize)
  +DStringPool::DStringPool(int hashTableSize,
  +                         MemoryManager* const manager)
   {
       fHashTableSize = hashTableSize;
  -    fHashTable = new DStringPoolEntry *[hashTableSize];
  +    fHashTable = (DStringPoolEntry**) manager->allocate
  +    (
  +        hashTableSize * sizeof(DStringPoolEntry*)
  +    );//new DStringPoolEntry *[hashTableSize];
  +    fMemoryManager = manager;
       for (int i=0; i<fHashTableSize; i++)
           fHashTable[i] = 0;
   };
  @@ -111,7 +116,7 @@
                              //   on spe->fString.
           }
       }
  -    delete [] fHashTable;
  +    fMemoryManager->deallocate(fHashTable);//delete [] fHashTable;
       fHashTable = 0;
   };
   
  @@ -129,7 +134,7 @@
               return (*pspe)->fString;
           pspe = &((*pspe)->fNext);
       }
  -    *pspe = spe = new DStringPoolEntry;
  +    *pspe = spe = new (fMemoryManager) DStringPoolEntry;
       spe->fNext = 0;
       spe->fString = DOMString(in);
       return spe->fString;
  @@ -152,7 +157,7 @@
               return (*pspe)->fString;
           pspe = &((*pspe)->fNext);
       }
  -    *pspe = spe = new DStringPoolEntry;
  +    *pspe = spe = new (fMemoryManager) DStringPoolEntry;
       spe->fNext = 0;
       spe->fString = DOMString(in);
       return spe->fString;
  
  
  
  1.6       +4 -1      xml-xerces/c/src/xercesc/dom/deprecated/DStringPool.hpp
  
  Index: DStringPool.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DStringPool.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DStringPool.hpp	15 May 2003 18:25:53 -0000	1.5
  +++ DStringPool.hpp	22 May 2003 02:26:50 -0000	1.6
  @@ -73,6 +73,7 @@
   
   #include "DOMString.hpp"
   #include <xercesc/util/XMLRegisterCleanup.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -90,7 +91,8 @@
   class DStringPool : public XMemory
   {
   public:
  -    DStringPool(int  hashTableSize);
  +    DStringPool(int  hashTableSize,
  +                MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       ~DStringPool();
   
       const DOMString &getPooledString(const DOMString &in);
  @@ -107,6 +109,7 @@
   
       DStringPoolEntry **fHashTable;
       int              fHashTableSize;
  +    MemoryManager*   fMemoryManager;
   };
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.4       +6 -3      xml-xerces/c/src/xercesc/dom/deprecated/DeepNodeListImpl.cpp
  
  Index: DeepNodeListImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DeepNodeListImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeepNodeListImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DeepNodeListImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -63,6 +63,7 @@
   #include "NodeImpl.hpp"
   #include "ElementImpl.hpp"
   #include "DStringPool.hpp"
  +#include "DocumentImpl.hpp"
   #include <limits.h>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -76,7 +77,8 @@
       changes = 0;
       this->rootNode = rootNod;
       this->tagName = tagNam;
  -    nodes=new NodeVector();
  +    MemoryManager* manager= rootNod->getDocument()->getMemoryManager();
  +    nodes=new (manager) NodeVector(manager);
       matchAll = tagName.equals(DStringPool::getStaticString("*"
                                                            , &kAstr
                                                            , reinitDeepNodeListImpl
  @@ -94,7 +96,8 @@
       changes = 0;
       this->rootNode = rootNod;
       this->tagName = localName;
  -    nodes=new NodeVector();
  +    MemoryManager* manager = rootNod->getDocument()->getMemoryManager();
  +    nodes=new (manager) NodeVector(manager);
       matchAll = tagName.equals(DStringPool::getStaticString("*"
                                                            , &kAstr
                                                            , reinitDeepNodeListImpl
  
  
  
  1.4       +3 -2      xml-xerces/c/src/xercesc/dom/deprecated/DocumentFragmentImpl.cpp
  
  Index: DocumentFragmentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DocumentFragmentImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DocumentFragmentImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ DocumentFragmentImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -62,6 +62,7 @@
   #include "DOM_Node.hpp"
   #include "DOM_DOMException.hpp"
   #include "DStringPool.hpp"
  +#include "DocumentImpl.hpp"
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -93,7 +94,7 @@
   
   NodeImpl *DocumentFragmentImpl::cloneNode(bool deep)
   {
  -    return new DocumentFragmentImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) DocumentFragmentImpl(*this, deep);
   };
   
   
  
  
  
  1.8       +11 -10    xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.cpp
  
  Index: DocumentImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DocumentImpl.cpp	18 May 2003 14:02:03 -0000	1.7
  +++ DocumentImpl.cpp	22 May 2003 02:26:50 -0000	1.8
  @@ -98,7 +98,7 @@
   static DOMString *nam = 0;  // will be lazily initialized to "#document"
   static XMLRegisterCleanup namCleanup;
   
  -DocumentImpl::DocumentImpl()
  +DocumentImpl::DocumentImpl(MemoryManager* const manager)
       : ParentNode(this)
       , docType(0)
       , docElement(0)
  @@ -110,16 +110,17 @@
       , ranges(0)
       , fChanges(0)
       , errorChecking(true)
  -    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fMemoryManager(manager)
   {
  -    namePool    = new (fMemoryManager) DStringPool(257);
  +    namePool    = new (fMemoryManager) DStringPool(257, fMemoryManager);
   };
   
   
   //DOM Level 2
   DocumentImpl::DocumentImpl(const DOMString &fNamespaceURI,
                              const DOMString &qualifiedName,
  -                           DocumentTypeImpl *doctype)
  +                           DocumentTypeImpl *doctype,
  +                           MemoryManager* const manager)
       : ParentNode(this)
       , docType(0)
       , docElement(0)
  @@ -131,10 +132,10 @@
       , ranges(0)
       , fChanges(0)
       , errorChecking(true)
  -    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fMemoryManager(manager)
   {
   	setDocumentType(doctype);
  -    namePool    = new (fMemoryManager) DStringPool(257);
  +    namePool    = new (fMemoryManager) DStringPool(257, fMemoryManager);
       appendChild(createElementNS(fNamespaceURI, qualifiedName));  //root element
   }
   
  @@ -197,7 +198,7 @@
   NodeImpl *DocumentImpl::cloneNode(bool deep) {
   
       // clone the node itself
  -    DocumentImpl *newdoc = new DocumentImpl();
  +    DocumentImpl *newdoc = new (fMemoryManager) DocumentImpl(fMemoryManager);
   
       // then the children by _importing_ them
       if (deep) {
  @@ -429,7 +430,7 @@
   
   DeepNodeListImpl *DocumentImpl::getElementsByTagName(const DOMString &tagname)
   {
  -    return new DeepNodeListImpl(this,tagname);
  +    return new (fMemoryManager) DeepNodeListImpl(this,tagname);
   };
   
   
  @@ -695,7 +696,7 @@
   DeepNodeListImpl *DocumentImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI,
   	const DOMString &fLocalName)
   {
  -    return new DeepNodeListImpl(this, fNamespaceURI, fLocalName);
  +    return new (fMemoryManager) DeepNodeListImpl(this, fNamespaceURI, fLocalName);
   }
   
   
  
  
  
  1.7       +5 -3      xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.hpp
  
  Index: DocumentImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/DocumentImpl.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DocumentImpl.hpp	18 May 2003 14:02:03 -0000	1.6
  +++ DocumentImpl.hpp	22 May 2003 02:26:50 -0000	1.7
  @@ -174,9 +174,11 @@
      	friend class DOMParser;
   
   public:
  -    DocumentImpl();
  +    DocumentImpl(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       DocumentImpl(const DOMString &namespaceURI,	    //DOM Level 2
  -	const DOMString &qualifiedName, DocumentTypeImpl *doctype);
  +	             const DOMString &qualifiedName,
  +                 DocumentTypeImpl *doctype,
  +                 MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       virtual ~DocumentImpl();
       virtual bool isDocumentImpl();   // RTTI replacement function
   
  
  
  
  1.4       +3 -2      xml-xerces/c/src/xercesc/dom/deprecated/ElementDefinitionImpl.cpp
  
  Index: ElementDefinitionImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/ElementDefinitionImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ElementDefinitionImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ ElementDefinitionImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -59,6 +59,7 @@
    */
   
   #include "ElementDefinitionImpl.hpp"
  +#include "DocumentImpl.hpp"
   #include "NamedNodeMapImpl.hpp"
   #include "NodeImpl.hpp"
   
  @@ -95,7 +96,7 @@
   
   NodeImpl *ElementDefinitionImpl::cloneNode(bool deep)
   {
  -    return new ElementDefinitionImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) ElementDefinitionImpl(*this, deep);
   };
   
   
  
  
  
  1.5       +11 -33    xml-xerces/c/src/xercesc/dom/deprecated/ElementImpl.cpp
  
  Index: ElementImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/ElementImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElementImpl.cpp	15 May 2003 18:25:53 -0000	1.4
  +++ ElementImpl.cpp	22 May 2003 02:26:50 -0000	1.5
  @@ -115,7 +115,7 @@
   
   NodeImpl *ElementImpl::cloneNode(bool deep)
   {
  -    return new ElementImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) ElementImpl(*this, deep);
   };
   
   
  @@ -170,7 +170,7 @@
   
   DeepNodeListImpl *ElementImpl::getElementsByTagName(const DOMString &tagname)
   {
  -    return new DeepNodeListImpl(this,tagname);
  +    return new (getOwnerDocument()->getMemoryManager()) DeepNodeListImpl(this,tagname);
   };
   
   
  @@ -242,10 +242,7 @@
       if (!newAttr)
       {
   		if (attributes == 0) {
  -            if (getOwnerDocument())
  -                attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
  -			else
  -                attributes = new AttrMapImpl(this, null);
  +            attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
           }
           newAttr = (AttrImpl*)ownerDocument->createAttribute(nam);
           attributes->setNamedItem(newAttr);
  @@ -268,10 +265,7 @@
       if (!(newAttr->isAttrImpl()))
           throw DOM_DOMException(DOM_DOMException::WRONG_DOCUMENT_ERR, null);
   	if (attributes == 0) {
  -        if (getOwnerDocument())
  -            attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
  -		else
  -            attributes = new AttrMapImpl(this, null);
  +        attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
       }
       AttrImpl *oldAttr =
         (AttrImpl *) attributes->getNamedItem(newAttr->getName());
  @@ -322,10 +316,7 @@
                                                       qualifiedName);
       newAttr->setNodeValue(fValue);
   	if (attributes == 0) {
  -        if (getOwnerDocument())
  -		    attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
  -        else
  -            attributes = new AttrMapImpl(this, null);
  +        attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
       }
       AttrImpl *oldAttr = (AttrImpl *)attributes->setNamedItem(newAttr);
   
  @@ -378,10 +369,7 @@
           }
       }
       if (attributes == 0) {
  -        if (getOwnerDocument())
  -            attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
  -        else
  -            attributes = new AttrMapImpl(this, null);
  +        attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, null);
       }
       AttrImpl *oldAttr = (AttrImpl *) attributes->getNamedItemNS(newAttr->getNamespaceURI(), newAttr->getLocalName());
   
  @@ -404,7 +392,7 @@
   DeepNodeListImpl *ElementImpl::getElementsByTagNameNS(const DOMString &fNamespaceURI,
   	const DOMString &fLocalName)
   {
  -    return new DeepNodeListImpl(this,fNamespaceURI, fLocalName);
  +    return new (getOwnerDocument()->getMemoryManager())DeepNodeListImpl(this,fNamespaceURI, fLocalName);
   }
   
   bool ElementImpl::hasAttributes()
  @@ -468,10 +456,7 @@
   NodeImpl *ElementImpl::NNM_setNamedItem(NodeImpl *nnm_arg)
   {
   	if (getAttributes() == null) {
  -        if (getOwnerDocument())
  -		    attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this);
  -        else
  -		    attributes = new AttrMapImpl(this);
  +	    attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this);
       }
   	return attributes->setNamedItem(nnm_arg);
   }
  @@ -495,10 +480,7 @@
   NodeImpl *ElementImpl::NNM_setNamedItemNS(NodeImpl *nnm_arg)
   {
   	if (getAttributes() == null) {
  -        if (getOwnerDocument())
  -            attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this);
  -		else
  -            attributes = new AttrMapImpl(this);
  +        attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this);
       }
   	return getAttributes()->setNamedItemNS(nnm_arg);
   }
  @@ -545,11 +527,7 @@
   	
   	AttrMapImpl* defAttrs = getDefaultAttributes();
   	if (defAttrs) {
  -
  -        if (getOwnerDocument())
  -            attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, defAttrs);
  -        else
  -            attributes = new AttrMapImpl(this, defAttrs);
  +        attributes = new (getOwnerDocument()->getMemoryManager()) AttrMapImpl(this, defAttrs);
       }
   }
   
  
  
  
  1.5       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/ElementNSImpl.cpp
  
  Index: ElementNSImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/ElementNSImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ElementNSImpl.cpp	20 Dec 2002 22:10:57 -0000	1.4
  +++ ElementNSImpl.cpp	22 May 2003 02:26:50 -0000	1.5
  @@ -107,7 +107,7 @@
   };
   
   NodeImpl * ElementNSImpl::cloneNode(bool deep) {
  -    return new ElementNSImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) ElementNSImpl(*this, deep);
   }
   
   DOMString ElementNSImpl::getNamespaceURI()
  
  
  
  1.4       +3 -2      xml-xerces/c/src/xercesc/dom/deprecated/EntityImpl.cpp
  
  Index: EntityImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/EntityImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EntityImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ EntityImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -61,6 +61,7 @@
   #include "DOM_DOMException.hpp"
   #include "DOM_Node.hpp"
   #include "EntityImpl.hpp"
  +#include "DocumentImpl.hpp"
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -99,7 +100,7 @@
   
   NodeImpl *EntityImpl::cloneNode(bool deep)
   {
  -    return new EntityImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) EntityImpl(*this, deep);
   };
   
   
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/EntityReferenceImpl.cpp
  
  Index: EntityReferenceImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/EntityReferenceImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EntityReferenceImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ EntityReferenceImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -168,7 +168,7 @@
   
   NodeImpl *EntityReferenceImpl::cloneNode(bool deep)
   {
  -    return new EntityReferenceImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) EntityReferenceImpl(*this, deep);
   }
   
   
  
  
  
  1.4       +17 -9     xml-xerces/c/src/xercesc/dom/deprecated/NamedNodeMapImpl.cpp
  
  Index: NamedNodeMapImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NamedNodeMapImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NamedNodeMapImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ NamedNodeMapImpl.cpp	22 May 2003 02:26:50 -0000	1.4
  @@ -105,11 +105,12 @@
   
   NamedNodeMapImpl *NamedNodeMapImpl::cloneMap(NodeImpl *ownerNod)
   {
  -    NamedNodeMapImpl *newmap = new NamedNodeMapImpl(ownerNod);
  +    MemoryManager* manager = ownerNod->getDocument()->getMemoryManager();
  +    NamedNodeMapImpl *newmap = new (manager) NamedNodeMapImpl(ownerNod);
   	
       if (nodes != null)
       {
  -        newmap->nodes = new NodeVector(nodes->size());
  +        newmap->nodes = new (manager) NodeVector(nodes->size(), manager);
           for (unsigned int i = 0; i < nodes->size(); ++i)
           {
               NodeImpl *n = nodes->elementAt(i)->cloneNode(true);
  @@ -285,8 +286,10 @@
       else
       {
           i=-1-i; // Insert point (may be end of list)
  -        if(null==nodes)
  -            nodes=new NodeVector();
  +        if(null==nodes) {
  +            MemoryManager* manager = ownerNode->getDocument()->getMemoryManager();
  +            nodes=new (manager) NodeVector(manager);
  +        }
           nodes->insertElementAt(arg,i);
       }
       if (previous != null) {
  @@ -390,8 +393,10 @@
           i=findNamePoint(arg->getNodeName()); // Insert point (may be end of list)
           if (i<0)
             i = -1 - i;
  -        if(null==nodes)
  -            nodes=new NodeVector();
  +        if(null==nodes) {
  +            MemoryManager* manager = ownerNode->getDocument()->getMemoryManager();
  +            nodes=new (manager) NodeVector(manager);
  +        }
           nodes->insertElementAt(arg,i);
       }
       if (previous != null) {
  @@ -441,9 +446,12 @@
   void NamedNodeMapImpl::cloneContent(NamedNodeMapImpl *srcmap) {
      if ((srcmap != null) && (srcmap->nodes != null) && (srcmap->nodes->size() > 0))
   	{
  -		if (nodes != null)
  +		if (nodes != null) {
   			delete nodes;
  -		nodes = new NodeVector(srcmap->nodes->size());
  +		}
  +
  +        MemoryManager* manager = ownerNode->getDocument()->getMemoryManager();
  +        nodes = new (manager) NodeVector(srcmap->nodes->size(), manager);
   		for (unsigned int i = 0; i < srcmap->nodes->size(); i++)
   		{
   			NodeImpl *n = srcmap->nodes->elementAt(i);
  
  
  
  1.3       +7 -5      xml-xerces/c/src/xercesc/dom/deprecated/NodeIDMap.cpp
  
  Index: NodeIDMap.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NodeIDMap.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NodeIDMap.cpp	4 Nov 2002 15:04:44 -0000	1.2
  +++ NodeIDMap.cpp	22 May 2003 02:26:51 -0000	1.3
  @@ -69,7 +69,9 @@
   static const float gMaxFill = 0.8f;   // The maximum fraction of the total
                                       // table entries to consume before exanding.
   
  -NodeIDMap::NodeIDMap(int initialSize)
  +NodeIDMap::NodeIDMap(int initialSize,
  +                     MemoryManager* const manager)
  +: fMemoryManager(manager)
   {
       for (fSizeIndex = 0; gPrimes[fSizeIndex] < initialSize; fSizeIndex++)
       {
  @@ -86,7 +88,7 @@
       fNumEntries = 0;
       fMaxEntries = (unsigned long)(float(fSize) * gMaxFill);
   
  -    fTable = new AttrImpl *[fSize];
  +    fTable = (AttrImpl**) manager->allocate(fSize * sizeof(AttrImpl*));// new AttrImpl *[fSize];
       unsigned int i;
       for (i=0; i<fSize; i++)
           fTable[i] = 0;
  @@ -96,7 +98,7 @@
   NodeIDMap::~NodeIDMap()
   {
       delete[] fTable;
  -    fTable = 0;
  +    fMemoryManager->deallocate(fTable);//fTable = 0;
   };
   
   
  @@ -251,7 +253,7 @@
       //
       //  Allocate the new table.
       //
  -    fTable = new AttrImpl *[fSize];
  +    fTable = (AttrImpl**) fMemoryManager->allocate(fSize * sizeof(AttrImpl*));//new AttrImpl *[fSize];
       unsigned int i;
       for (i=0; i<fSize; i++)
           fTable[i] = 0;
  @@ -267,7 +269,7 @@
               add(oldTable[i]);
       }
   
  -    delete [] oldTable;
  +    fMemoryManager->deallocate(oldTable);//delete [] oldTable;
   
   };
   
  
  
  
  1.4       +6 -4      xml-xerces/c/src/xercesc/dom/deprecated/NodeIDMap.hpp
  
  Index: NodeIDMap.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NodeIDMap.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NodeIDMap.hpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ NodeIDMap.hpp	22 May 2003 02:26:51 -0000	1.4
  @@ -78,7 +78,7 @@
   //  smaller when tuned for this exact usage, and the generic RefHashTableOf
   //  from the xerces utils project is not a paricularly good fit.
   //
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -87,10 +87,12 @@
   class DOMString;
   
   
  -class NodeIDMap {
  +class NodeIDMap : public XMemory {
   public:
   
  -    NodeIDMap(int initialSize);    // Create a new hash table, sized to hold "initialSize"
  +    // Create a new hash table, sized to hold "initialSize"
  +    NodeIDMap(int initialSize,
  +              MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
                                      //  Entries.  It will automatically grow if need be.
   
       virtual ~NodeIDMap();
  @@ -118,7 +120,7 @@
       unsigned int  fNumEntries;             // The number of entries used.
       unsigned int  fMaxEntries;             // The max number of entries to use before
                                              //   growing the table.
  -
  +    MemoryManager* fMemoryManager;
   
   };
   
  
  
  
  1.5       +1 -2      xml-xerces/c/src/xercesc/dom/deprecated/NodeIteratorImpl.hpp
  
  Index: NodeIteratorImpl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NodeIteratorImpl.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NodeIteratorImpl.hpp	15 May 2003 18:25:53 -0000	1.4
  +++ NodeIteratorImpl.hpp	22 May 2003 02:26:51 -0000	1.5
  @@ -70,7 +70,6 @@
   //  name is substituded for the *.
   //
   
  -#include <xercesc/util/XMemory.hpp>
   #include "DOM_Node.hpp"
   #include "DOM_NodeIterator.hpp"
   #include "RefCountedImpl.hpp"
  
  
  
  1.4       +15 -7     xml-xerces/c/src/xercesc/dom/deprecated/NodeVector.cpp
  
  Index: NodeVector.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NodeVector.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NodeVector.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ NodeVector.cpp	22 May 2003 02:26:51 -0000	1.4
  @@ -68,24 +68,29 @@
   //
   
   #include "NodeVector.hpp"
  +#include <xercesc/framework/MemoryManager.hpp>
   #include <assert.h>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
   
  -NodeVector::NodeVector()
  +NodeVector::NodeVector(MemoryManager* const manager)
  +: fMemoryManager(manager)
   {
   	init(10);
   };
   
  -NodeVector::NodeVector(unsigned int size) {
  +NodeVector::NodeVector(unsigned int size,
  +                       MemoryManager* const manager)
  +: fMemoryManager(manager)
  +{
   	init(size);
   };
   
   
   void NodeVector::init(unsigned int size) {
   	assert(size > 0);
  -	data = new NodeImpl *[size];
  +	data = (NodeImpl**) fMemoryManager->allocate(size * sizeof(NodeImpl*));//new NodeImpl *[size];
   	assert(data != 0);
   	allocatedSize = size;
   	nextFreeSlot = 0;
  @@ -93,7 +98,7 @@
   
   
   NodeVector::~NodeVector() {
  -	delete [] data;
  +	fMemoryManager->deallocate(data);//delete [] data;
   };
   
   
  @@ -109,12 +114,15 @@
                   unsigned int grow = allocatedSize/2;
                   if (grow < 50) grow = 50;
   		unsigned int newAllocatedSize = allocatedSize + grow;
  -		NodeImpl **newData = new NodeImpl *[newAllocatedSize];
  +		NodeImpl **newData = (NodeImpl**) fMemoryManager->allocate
  +        (
  +            newAllocatedSize * sizeof(NodeImpl*)
  +        );//new NodeImpl *[newAllocatedSize];
   		assert(newData != 0);
   		for (unsigned int i=0; i<allocatedSize; i++) {
   			newData[i] = data[i];
   		};
  -		delete [] data;
  +		fMemoryManager->deallocate(data);//delete [] data;
   		allocatedSize = newAllocatedSize;
   		data = newData;
   	};
  
  
  
  1.4       +8 -5      xml-xerces/c/src/xercesc/dom/deprecated/NodeVector.hpp
  
  Index: NodeVector.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/NodeVector.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NodeVector.hpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ NodeVector.hpp	22 May 2003 02:26:51 -0000	1.4
  @@ -70,7 +70,7 @@
   //
   
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -78,17 +78,20 @@
   class NodeImpl;
   
   
  -class  NodeVector {
  +class  NodeVector : public XMemory {
   private:
       NodeImpl        **data;
       unsigned int    allocatedSize;
       unsigned int    nextFreeSlot;
  +    MemoryManager*  fMemoryManager;
  +
       void            init(unsigned int size);
       void            checkSpace();
   
   public:
  -    NodeVector();
  -    NodeVector(unsigned int size);
  +    NodeVector(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
  +    NodeVector(unsigned int size,
  +               MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       ~NodeVector();
   
       unsigned int    size();
  
  
  
  1.4       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/TextImpl.cpp
  
  Index: TextImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/TextImpl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TextImpl.cpp	4 Nov 2002 15:04:44 -0000	1.3
  +++ TextImpl.cpp	22 May 2003 02:26:51 -0000	1.4
  @@ -95,7 +95,7 @@
   
   NodeImpl *TextImpl::cloneNode(bool deep)
   {
  -    return new TextImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) TextImpl(*this, deep);
   };
   
   
  
  
  
  1.5       +2 -2      xml-xerces/c/src/xercesc/dom/deprecated/XMLDeclImpl.cpp
  
  Index: XMLDeclImpl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/dom/deprecated/XMLDeclImpl.cpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLDeclImpl.cpp	20 Dec 2002 22:10:57 -0000	1.4
  +++ XMLDeclImpl.cpp	22 May 2003 02:26:51 -0000	1.5
  @@ -105,7 +105,7 @@
   
   NodeImpl * XMLDeclImpl::cloneNode(bool deep)
   {
  -    return new XMLDeclImpl(*this, deep);
  +    return new (getOwnerDocument()->getMemoryManager()) XMLDeclImpl(*this, deep);
   }
   
   DOMString XMLDeclImpl::getNodeName()
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org