I have attached the patch described below:
On Mon, Oct 20, 2003 at 01:38:55PM +0200, Ronald Landheer-Cieslak wrote:
> On Fri, Oct 17, 2003 at 10:11:48AM -0700, [EMAIL PROTECTED] wrote:
> > You can already get compile-time alignment through a #define, which you 
> > could also define to be 0, which would give you half of "b".
> Please don't recommend something that will give me unspecified results:
> the delete operator reads at p-(headersize) to get the pointer to the
> memory manager. If (headersize == 0) it will read at p, which will contain
> user data, which may be anything.
> 
> If you want, I can supply a patch that will make Xerces use the default 
> memory manager (always) if (headersize == 0) (or use the passed-in manager
> in the case of the second delete operator).
HTH

rlc

-- 
Innocence ends when one is stripped of the delusion that one likes oneself.
                -- Joan Didion, "On Self Respect"
Index: XMemory.cpp
===================================================================
RCS file: /home/cvspublic/xml-xerces/c/src/xercesc/util/XMemory.cpp,v
retrieving revision 1.8
diff -b -w -u -p -r1.8 XMemory.cpp
--- XMemory.cpp 25 Aug 2003 16:12:55 -0000      1.8
+++ XMemory.cpp 20 Oct 2003 11:28:18 -0000
@@ -113,6 +113,9 @@ void XMemory::operator delete(void* p)
 {
     if (p != 0)
     {
+#if defined(XML_PLATFORM_NEW_BLOCK_ALIGNMENT) && !XML_PLATFORM_NEW_BLOCK_ALIGNMENT
+           XMLPlatformUtils::fgMemoryManager->deallocate(p);
+#else
                size_t headerSize = 
XMLPlatformUtils::alignPointerForNewBlockAllocation(
                                                                                       
 sizeof(MemoryManager*));
         void* const block = (char*)p - headerSize;
@@ -120,6 +123,7 @@ void XMemory::operator delete(void* p)
         MemoryManager* const manager = *(MemoryManager**)block;
         assert(manager != 0);
         manager->deallocate(block);
+#endif
     }
 }
 
@@ -132,6 +136,9 @@ void XMemory::operator delete(void* p, M
        
     if (p != 0)
     {
+#if defined(XML_PLATFORM_NEW_BLOCK_ALIGNMENT) && !XML_PLATFORM_NEW_BLOCK_ALIGNMENT
+           manager->deallocate(p);
+#else
         size_t headerSize = 
XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(MemoryManager*));
         void* const block = (char*)p - headerSize;
         assert(*(MemoryManager**)block == manager);
@@ -142,6 +149,7 @@ void XMemory::operator delete(void* p, M
          */ 
         MemoryManager* pM = *(MemoryManager**)block;
         pM->deallocate(block);
+#endif
     }
 }
 

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

Reply via email to