Index: trunk/src/libs/xpcom18a4/Config.kmk
===================================================================
--- trunk/src/libs/xpcom18a4/Config.kmk	(revision 101851)
+++ trunk/src/libs/xpcom18a4/Config.kmk	(revision 101852)
@@ -373,5 +373,4 @@
 	xpcom/base/nsIDebug.idl \
 	xpcom/base/nsIInterfaceRequestor.idl \
-	xpcom/base/nsIMemory.idl \
 	xpcom/base/nsIProgrammingLanguage.idl \
 	xpcom/base/nsISupports.idl \
Index: trunk/src/libs/xpcom18a4/Makefile.kmk
===================================================================
--- trunk/src/libs/xpcom18a4/Makefile.kmk	(revision 101851)
+++ trunk/src/libs/xpcom18a4/Makefile.kmk	(revision 101852)
@@ -580,5 +580,4 @@
 	xpcom/base/nsExceptionService.cpp \
 	xpcom/base/nsID.cpp \
-	xpcom/base/nsMemoryImpl.cpp \
 	xpcom/base/nsTraceRefcntImpl.cpp
 $(evalcall VBOX_XPCOM_X86,VBox-xpcom-base)
@@ -1126,5 +1125,4 @@
 		nsIDebug.xpt \
 		nsIInterfaceRequestor.xpt \
-		nsIMemory.xpt \
 		nsIProgrammingLanguage.xpt \
 		nsISupports.xpt \
Index: trunk/src/libs/xpcom18a4/xpcom/base/nsIMemory.idl
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/base/nsIMemory.idl	(revision 101851)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsISupports.idl"
-
-/**
- *
- * nsIMemory: interface to allocate and deallocate memory. Also provides
- * for notifications in low-memory situations.
- *
- * A client that wishes to be notified of low memory situations (for
- * example, because the client maintains a large memory cache that
- * could be released when memory is tight) should register with the
- * observer service (see nsIObserverService) using the topic 
- * "memory-pressure". There are three specific types of notications 
- * that can occur.  These types will be passed as the |aData| 
- * parameter of the of the "memory-pressure" notification: 
- * 
- * "low-memory"
- * This will be passed as the extra data when the pressure 
- * observer is being asked to flush for low-memory conditions.
- *
- * "heap-minimize"
- * This will be passed as the extra data when the pressure 
- * observer is being asked to flush because of a heap minimize 
- * call.
- *
- * "alloc-failure"
- * This will be passed as the extra data when the pressure 
- * observer has been asked to flush because a malloc() or 
- * realloc() has failed.
- *
- * @status FROZEN
- */
-
-[scriptable, uuid(59e7e77a-38e4-11d4-8cf5-0060b0fc14a3)]
-interface nsIMemory : nsISupports
-{
-    /**
-     * Allocates a block of memory of a particular size. If the memory 
-     * cannot be allocated (because of an out-of-memory condition), null
-     * is returned.
-     *
-     * @param size - the size of the block to allocate
-     * @result the block of memory
-     */
-    [noscript, notxpcom] voidPtr alloc(in size_t size);
-
-    /**
-     * Reallocates a block of memory to a new size.
-     *
-     * @param ptr - the block of memory to reallocate
-     * @param size - the new size
-     * @result the reallocated block of memory
-     *
-     * If ptr is null, this function behaves like malloc.
-     * If s is the size of the block to which ptr points, the first
-     * min(s, size) bytes of ptr's block are copied to the new block.
-     * If the allocation succeeds, ptr is freed and a pointer to the 
-     * new block returned.  If the allocation fails, ptr is not freed
-     * and null is returned. The returned value may be the same as ptr.
-     */
-    [noscript, notxpcom] voidPtr realloc(in voidPtr ptr,
-                                         in size_t newSize);
-
-    /**
-     * Frees a block of memory. Null is a permissible value, in which case
-     * nothing happens. 
-     *
-     * @param ptr - the block of memory to free
-     */
-    [noscript, notxpcom] void free(in voidPtr ptr);
-
-    /**
-     * Attempts to shrink the heap.
-     * @param immediate - if true, heap minimization will occur
-     *   immediately if the call was made on the main thread. If
-     *   false, the flush will be scheduled to happen when the app is
-     *   idle.
-     * @return NS_ERROR_FAILURE if 'immediate' is set an the call
-     *   was not on the application's main thread.
-     */
-    void heapMinimize(in boolean immediate);
-
-    /**
-     * This predicate can be used to determine if we're in a low-memory
-     * situation (what constitutes low-memory is platform dependent). This
-     * can be used to trigger the memory pressure observers.
-     */
-    boolean isLowMemory();
-};
-
Index: trunk/src/libs/xpcom18a4/xpcom/base/nsMemoryImpl.cpp
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/base/nsMemoryImpl.cpp	(revision 101851)
+++ 	(revision )
@@ -1,152 +1,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "nsMemoryImpl.h"
-#include "prmem.h"
-#include "nsAlgorithm.h"
-#include "nsIServiceManager.h"
-#include "nsIObserverService.h"
-#include "nsAutoLock.h"
-#include "nsIEventQueueService.h"
-#include "nsString.h"
-
-nsMemoryImpl* gMemory = nsnull;
-
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsMemoryImpl, nsIMemory)
-
-NS_METHOD
-nsMemoryImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
-{
-    NS_ENSURE_ARG_POINTER(aInstancePtr);
-    NS_ENSURE_PROPER_AGGREGATION(outer, aIID);
-    if (gMemory && NS_SUCCEEDED(gMemory->QueryInterface(aIID, aInstancePtr)))
-        return NS_OK;
-
-    nsMemoryImpl* mm = new nsMemoryImpl();
-    if (mm == NULL)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    nsresult rv;
-
-    do {
-        rv = mm->QueryInterface(aIID, aInstancePtr);
-        if (NS_FAILED(rv))
-            break;
-
-        rv = NS_OK;
-    } while (0);
-
-    if (NS_FAILED(rv))
-        delete mm;
-
-    return rv;
-}
-
-
-nsMemoryImpl::nsMemoryImpl()
-{
-}
-
-nsMemoryImpl::~nsMemoryImpl()
-{
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-NS_IMETHODIMP_(void *) 
-nsMemoryImpl::Alloc(PRSize size)
-{
-    NS_ASSERTION(size, "nsMemoryImpl::Alloc of 0");
-    void* result = PR_Malloc(size);
-    return result;
-}
-
-NS_IMETHODIMP_(void *)
-nsMemoryImpl::Realloc(void * ptr, PRSize size)
-{
-    void* result = PR_Realloc(ptr, size);
-    return result;
-}
-
-NS_IMETHODIMP_(void)
-nsMemoryImpl::Free(void * ptr)
-{
-    PR_Free(ptr);
-}
-
-NS_IMETHODIMP
-nsMemoryImpl::HeapMinimize(PRBool aImmediate)
-{
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsMemoryImpl::IsLowMemory(PRBool *result)
-{
-    *result = PR_FALSE;
-    return NS_OK;
-}
-
-static void
-EnsureGlobalMemoryService()
-{
-    if (gMemory) return;
-    nsresult rv = nsMemoryImpl::Create(nsnull, NS_GET_IID(nsIMemory), (void**)&gMemory);
-    NS_ASSERTION(NS_SUCCEEDED(rv), "nsMemoryImpl::Create failed");
-    NS_ASSERTION(gMemory, "improper xpcom initialization");
-}
-
-nsresult 
-nsMemoryImpl::Startup()
-{
-    EnsureGlobalMemoryService();
-    if (! gMemory)
-        return NS_ERROR_FAILURE;
-
-    return NS_OK;
-}
-
-nsresult 
-nsMemoryImpl::Shutdown()
-{
-    if (gMemory) {
-        NS_RELEASE(gMemory);
-        gMemory = nsnull;
-    }
-
-    return NS_OK;
-}
Index: trunk/src/libs/xpcom18a4/xpcom/base/nsMemoryImpl.h
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/base/nsMemoryImpl.h	(revision 101851)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsMemoryImpl_h__
-#define nsMemoryImpl_h__
-
-#include "nsMemory.h"
-#include "nsISupportsArray.h"
-#include "nsCOMPtr.h"
-#include "plevent.h"
-
-class nsMemoryImpl : public nsIMemory
-{
-public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIMEMORY
-
-    nsMemoryImpl();
-
-    // called from xpcom initialization/finalization:
-    static nsresult Startup();
-    static nsresult Shutdown();
-
-    static NS_METHOD
-    Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
-
-private:
-    ~nsMemoryImpl();
-};
-
-#endif // nsMemoryImpl_h__
Index: trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h	(revision 101851)
+++ trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h	(revision 101852)
@@ -171,17 +171,4 @@
 
 /**
- * Public Method to access to the memory manager.  See nsIMemory
- * 
- * @status FROZEN
- * @param result Interface pointer to the memory manager 
- *
- * @return NS_OK for success;
- *         other error codes indicate a failure during initialisation.
- *
- */
-extern "C" NS_COM nsresult
-NS_GetMemoryManager(nsIMemory* *result);
-
-/**
  * Public Method to create an instance of a nsILocalFile.  This function
  * may be called prior to NS_InitXPCOM2.  
Index: trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp	(revision 101851)
+++ trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp	(revision 101852)
@@ -48,5 +48,4 @@
 #include "nsBinaryStream.h"
 
-#include "nsMemoryImpl.h"
 #include "nsDebugImpl.h"
 #include "nsTraceRefcntImpl.h"
@@ -124,5 +123,4 @@
 
 static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
-static NS_DEFINE_CID(kMemoryCID, NS_MEMORY_CID);
 static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
 
@@ -326,5 +324,4 @@
 
 static const nsModuleComponentInfo components[] = {
-    COMPONENT(MEMORY, nsMemoryImpl::Create),
     COMPONENT(DEBUG,  nsDebugImpl::Create),
 #define NS_ERRORSERVICE_CLASSNAME NS_ERRORSERVICE_NAME
@@ -420,19 +417,4 @@
 const int components_length = sizeof(components) / sizeof(components[0]);
 
-// gMemory will be freed during shutdown.
-static nsIMemory* gMemory = nsnull;
-nsresult NS_COM NS_GetMemoryManager(nsIMemory* *result)
-{
-    nsresult rv = NS_OK;
-    if (!gMemory)
-    {
-        rv = nsMemoryImpl::Create(nsnull,
-                                  NS_GET_IID(nsIMemory),
-                                  (void**)&gMemory);
-    }
-    NS_IF_ADDREF(*result = gMemory);
-    return rv;
-}
-
 // gDebug will be freed during shutdown.
 static nsIDebug* gDebug = nsnull;
@@ -500,8 +482,4 @@
     // Establish the main thread here.
     rv = nsIThread::SetMainThread();
-    if (NS_FAILED(rv)) return rv;
-
-    // Startup the memory manager
-    rv = nsMemoryImpl::Startup();
     if (NS_FAILED(rv)) return rv;
 
@@ -586,10 +564,4 @@
         }
     }
-
-    nsCOMPtr<nsIMemory> memory;
-    NS_GetMemoryManager(getter_AddRefs(memory));
-    // dougt - these calls will be moved into a new interface when nsIComponentManager is frozen.
-    rv = compMgr->RegisterService(kMemoryCID, memory);
-    if (NS_FAILED(rv)) return rv;
 
     rv = compMgr->RegisterService(kComponentManagerCID, NS_STATIC_CAST(nsIComponentManager*, compMgr));
@@ -914,6 +886,4 @@
 
     EmptyEnumeratorImpl::Shutdown();
-    nsMemoryImpl::Shutdown();
-    NS_IF_RELEASE(gMemory);
 
     nsThread::Shutdown();
Index: trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.cpp
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.cpp	(revision 101851)
+++ trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.cpp	(revision 101852)
@@ -36,53 +36,7 @@
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsXPCOM.h"
 #include "nsMemory.h"
-#include "nsXPCOMPrivate.h"
 
-static nsIMemory* gMemory = nsnull;
-
-static NS_METHOD FreeGlobalMemory(void)
-{
-    NS_ASSERTION(gMemory, "must be not null after SetupGlobalMemory");
-    NS_IF_RELEASE(gMemory);
-    return NS_OK;
-}
-
-#define ENSURE_ALLOCATOR \
-  (gMemory ? PR_TRUE : (PRBool)(SetupGlobalMemory() != nsnull))
-
-static nsIMemory*
-SetupGlobalMemory()
-{
-    NS_ASSERTION(!gMemory, "must be called once");
-    if (!gMemory)
-    {
-        NS_GetMemoryManager(&gMemory);
-        NS_ASSERTION(gMemory, "can't get memory manager!");
-        if (gMemory)
-            NS_RegisterXPCOMExitRoutine(FreeGlobalMemory, 0);
-    }
-    return gMemory;
-}
-
-#ifdef XPCOM_GLUE
-nsresult GlueStartupMemory() 
-{
-    NS_ASSERTION(!gMemory, "must be called once");
-    if (!gMemory)
-    {
-        NS_GetMemoryManager(&gMemory);
-        NS_ASSERTION(gMemory, "can't get memory manager!");
-        if (!gMemory)
-            return NS_ERROR_FAILURE;
-    }
-    return NS_OK;
-}
-
-void GlueShutdownMemory()
-{
-    NS_IF_RELEASE(gMemory);
-}
-#endif
+#include <iprt/mem.h>
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -92,8 +46,5 @@
 nsMemory::Alloc(PRSize size)
 {
-    if (!ENSURE_ALLOCATOR)
-        return nsnull;
- 
-   return gMemory->Alloc(size);
+    return RTMemAlloc(size);
 }
 
@@ -101,8 +52,5 @@
 nsMemory::Realloc(void* ptr, PRSize size)
 {
-    if (!ENSURE_ALLOCATOR)
-        return nsnull;    
-
-    return gMemory->Realloc(ptr, size);
+    return RTMemRealloc(ptr, size);
 }
 
@@ -110,17 +58,5 @@
 nsMemory::Free(void* ptr)
 {
-    if (!ENSURE_ALLOCATOR)
-        return;    
-
-    gMemory->Free(ptr);
-}
-
-NS_COM nsresult
-nsMemory::HeapMinimize(PRBool aImmediate)
-{
-    if (!ENSURE_ALLOCATOR)
-        return NS_ERROR_FAILURE;    
-
-    return gMemory->HeapMinimize(aImmediate);
+    RTMemFree(ptr);
 }
 
@@ -128,22 +64,5 @@
 nsMemory::Clone(const void* ptr, PRSize size)
 {
-    if (!ENSURE_ALLOCATOR)
-        return nsnull;    
-
-    void* newPtr = gMemory->Alloc(size);
-    if (newPtr)
-        memcpy(newPtr, ptr, size);
-    return newPtr;
-}
-
-NS_COM nsIMemory*
-nsMemory::GetGlobalMemoryService()
-{
-    if (!ENSURE_ALLOCATOR)
-        return nsnull;    
-   
-    nsIMemory* result = gMemory;
-    NS_IF_ADDREF(result);
-    return result;
+    return RTMemDup(ptr, size);
 }
 
Index: trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.h
===================================================================
--- trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.h	(revision 101851)
+++ trunk/src/libs/xpcom18a4/xpcom/glue/nsMemory.h	(revision 101852)
@@ -39,15 +39,5 @@
 #define nsMemory_h__
 
-#include "nsIMemory.h"
-
-#define NS_MEMORY_CONTRACTID "@mozilla.org/xpcom/memory-service;1"
-#define NS_MEMORY_CLASSNAME  "Global Memory Service"
-#define NS_MEMORY_CID                                \
-{ /* 30a04e40-38e7-11d4-8cf5-0060b0fc14a3 */         \
-    0x30a04e40,                                      \
-    0x38e7,                                          \
-    0x11d4,                                          \
-    {0x8c, 0xf5, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
-}
+#include "nsISupports.h"
 
 
@@ -67,7 +57,5 @@
     static NS_COM void*      Realloc(void* ptr, size_t size);
     static NS_COM void       Free(void* ptr);
-    static NS_COM nsresult   HeapMinimize(PRBool aImmediate);
     static NS_COM void*      Clone(const void* ptr, size_t size);
-    static NS_COM nsIMemory* GetGlobalMemoryService();       // AddRefs
 };
 
