diff --git a/src/xercesc/dom/DOMNamedNodeMap.hpp b/src/xercesc/dom/DOMNamedNodeMap.hpp
index 0a255a7b98c6d202dc6366d2941414aca8509eca..8645dcca4ad3c77a2eb73d99fced0d9e7930664b 100644
--- a/src/xercesc/dom/DOMNamedNodeMap.hpp
+++ b/src/xercesc/dom/DOMNamedNodeMap.hpp
@@ -278,6 +278,8 @@ public:
 
 };
 
+#define GetDOMNamedNodeMapMemoryManager   GET_INDIRECT_MM(fOwnerNode)
+
 XERCES_CPP_NAMESPACE_END
 
 #endif
diff --git a/src/xercesc/dom/DOMNode.hpp b/src/xercesc/dom/DOMNode.hpp
index 3e06cd82e6587f82d6714dd1cdeef7333a1f315d..ae3ae1465c40d0488e855ae06938a7ed9323f8d9 100644
--- a/src/xercesc/dom/DOMNode.hpp
+++ b/src/xercesc/dom/DOMNode.hpp
@@ -1019,7 +1019,26 @@ public:
     //@}
 #endif
 };
- 
+
+/***
+ * Utilities macros for getting memory manager within DOM
+***/
+#define GET_OWNER_DOCUMENT(ptr)      \
+        ((DOMDocumentImpl*)(ptr->getOwnerDocument()))
+
+#define GET_DIRECT_MM(ptr)           \
+        ptr ? ((DOMDocumentImpl*)ptr)->getMemoryManager() : XMLPlatformUtils::fgMemoryManager        
+
+#define GET_INDIRECT_MM(ptr)                                                    \
+        !ptr ? XMLPlatformUtils::fgMemoryManager :                              \
+        GET_OWNER_DOCUMENT(ptr) ? GET_OWNER_DOCUMENT(ptr)->getMemoryManager() : \
+        XMLPlatformUtils::fgMemoryManager
+
+/***
+ * For DOMNode and its derivatives
+***/
+#define GetDOMNodeMemoryManager GET_INDIRECT_MM(this)
+
 XERCES_CPP_NAMESPACE_END
 
 #endif
diff --git a/src/xercesc/dom/DOMNodeIterator.hpp b/src/xercesc/dom/DOMNodeIterator.hpp
index 9818ba13c9dea6eeca2bd54e4be55d49e3e7ee55..ddba4fd7fbd6147ca57fc7139aa3a5ab1be12f10 100644
--- a/src/xercesc/dom/DOMNodeIterator.hpp
+++ b/src/xercesc/dom/DOMNodeIterator.hpp
@@ -228,6 +228,8 @@ public:
     //@}
 };
 
+#define GetDOMNodeIteratorMemoryManager GET_DIRECT_MM(fDocument)
+
 XERCES_CPP_NAMESPACE_END
 
 #endif
diff --git a/src/xercesc/dom/DOMTreeWalker.hpp b/src/xercesc/dom/DOMTreeWalker.hpp
index aba341450320fe77db00dee802ba873126ddda66..8fbdf221fce707d841e31ebc678bebd258fbfe1d 100644
--- a/src/xercesc/dom/DOMTreeWalker.hpp
+++ b/src/xercesc/dom/DOMTreeWalker.hpp
@@ -308,6 +308,8 @@ public:
     //@}
 };
 
+#define GetDOMTreeWalkerMemoryManager GET_INDIRECT_MM(fCurrentNode)
+
 XERCES_CPP_NAMESPACE_END
 
 #endif