Index: /trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp	(revision 39743)
+++ /trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp	(revision 39744)
@@ -508,5 +508,12 @@
                 }
 
-                rc = VERR_NO_MEMORY;
+                if (enmType == RTR0MEMOBJTYPE_PHYS_NC)
+                    rc = VERR_NO_PHYS_MEMORY;
+                else if (enmType == RTR0MEMOBJTYPE_LOW)
+                    rc = VERR_NO_LOW_MEMORY;
+                else if (enmType == RTR0MEMOBJTYPE_CONT)
+                    rc = VERR_NO_CONT_MEMORY;
+                else
+                    rc = VERR_NO_MEMORY;
             }
             else
Index: /trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 39743)
+++ /trunk/src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c	(revision 39744)
@@ -45,4 +45,5 @@
 #include "internal/memobj.h"
 
+
 /*******************************************************************************
 *   Structures and Typedefs                                                    *
@@ -62,4 +63,5 @@
 MALLOC_DEFINE(M_IPRTMOBJ, "iprtmobj", "IPRT - R0MemObj");
 
+
 /**
  * Gets the virtual memory map the specified object is mapped into.
@@ -112,5 +114,4 @@
         case RTR0MEMOBJTYPE_LOW:
         case RTR0MEMOBJTYPE_CONT:
-        {
             rc = vm_map_remove(kernel_map,
                                 (vm_offset_t)pMemFreeBSD->Core.pv,
@@ -118,5 +119,4 @@
             AssertMsg(rc == KERN_SUCCESS, ("%#x", rc));
             break;
-        }
 
         case RTR0MEMOBJTYPE_LOCK:
@@ -223,5 +223,5 @@
 static int rtR0MemObjFreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages,
                                             vm_paddr_t VmPhysAddrHigh, u_long uAlignment,
-                                            bool fContiguous, bool fWire)
+                                            bool fContiguous, bool fWire, int rcNoMem)
 {
     if (fContiguous)
@@ -230,6 +230,5 @@
                                                    uAlignment, fWire) != NULL)
             return VINF_SUCCESS;
-        else
-            return VERR_NO_MEMORY;
+        return rcNoMem;
     }
 
@@ -252,5 +251,5 @@
             }
             VM_OBJECT_UNLOCK(pObject);
-            return VERR_NO_MEMORY;
+            return rcNoMem;
         }
     }
@@ -259,5 +258,5 @@
 
 static int rtR0MemObjFreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable,
-                                        vm_paddr_t VmPhysAddrHigh, bool fContiguous)
+                                        vm_paddr_t VmPhysAddrHigh, bool fContiguous, int rcNoMem)
 {
     int rc;
@@ -275,6 +274,8 @@
     {
         rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages,
-                                              VmPhysAddrHigh, PAGE_SIZE, fContiguous, false);
-        if (RT_SUCCESS(rc)) {
+                                              VmPhysAddrHigh, PAGE_SIZE, fContiguous,
+                                              false, rcNoMem);
+        if (RT_SUCCESS(rc))
+        {
             vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb,
                         VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
@@ -287,5 +288,5 @@
         vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb);
     }
-    rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */
+    rc = rcNoMem; /** @todo fix translation (borrow from darwin) */
 
     vm_object_deallocate(pMemFreeBSD->pObject);
@@ -300,5 +301,5 @@
         return VERR_NO_MEMORY;
 
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false);
+    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false, VERR_NO_MEMORY);
     if (RT_FAILURE(rc))
     {
@@ -319,5 +320,5 @@
         return VERR_NO_MEMORY;
 
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false);
+    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false, VERR_NO_LOW_MEMORY);
     if (RT_FAILURE(rc))
     {
@@ -338,5 +339,5 @@
         return VERR_NO_MEMORY;
 
-    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true);
+    int rc = rtR0MemObjFreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true, VERR_NO_CONT_MEMORY);
     if (RT_FAILURE(rc))
     {
@@ -354,5 +355,5 @@
                                            size_t cb,
                                            RTHCPHYS PhysHighest, size_t uAlignment,
-                                           bool fContiguous)
+                                           bool fContiguous, int rcNoMem)
 {
     uint32_t   cPages = atop(cb);
@@ -373,11 +374,6 @@
 
     int rc = rtR0MemObjFreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh,
-                                              uAlignment, fContiguous, true);
-
-    if (RT_FAILURE(rc)) {
-        vm_object_deallocate(pMemFreeBSD->pObject);
-        rtR0MemObjDelete(&pMemFreeBSD->Core);
-    }
-    else
+                                              uAlignment, fContiguous, true, rcNoMem);
+    if (RT_SUCCESS(rc))
     {
         if (fContiguous)
@@ -392,4 +388,9 @@
         *ppMem = &pMemFreeBSD->Core;
     }
+    else
+    {
+        vm_object_deallocate(pMemFreeBSD->pObject);
+        rtR0MemObjDelete(&pMemFreeBSD->Core);
+    }
 
     return rc;
@@ -399,5 +400,5 @@
 DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment)
 {
-    return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true);
+    return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true, VERR_NO_MEMORY);
 }
 
@@ -405,5 +406,5 @@
 DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest)
 {
-    return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false);
+    return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false, VERR_NO_PHYS_MEMORY);
 }
 
@@ -497,5 +498,5 @@
      * The pvFixed address range must be within the VM space when specified.
      */
-    if (pvFixed != (void *)-1
+    if (   pvFixed != (void *)-1
         && (    (vm_offset_t)pvFixed      < vm_map_min(pMap)
             ||  (vm_offset_t)pvFixed + cb > vm_map_max(pMap)))
Index: /trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(revision 39743)
+++ /trunk/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c	(revision 39744)
@@ -180,7 +180,8 @@
  * @param   fFlagsLnx   The page allocation flags (GPFs).
  * @param   fContiguous Whether the allocation must be contiguous.
+ * @param   rcNoMem     What to return when we're out of pages.
  */
 static int rtR0MemObjLinuxAllocPages(PRTR0MEMOBJLNX *ppMemLnx, RTR0MEMOBJTYPE enmType, size_t cb,
-                                     size_t uAlignment, unsigned fFlagsLnx, bool fContiguous)
+                                     size_t uAlignment, unsigned fFlagsLnx, bool fContiguous, int rcNoMem)
 {
     size_t          iPage;
@@ -231,5 +232,5 @@
         {
             rtR0MemObjDelete(&pMemLnx->Core);
-            return VERR_NO_MEMORY;
+            return rcNoMem;
         }
     }
@@ -245,5 +246,5 @@
                     __free_page(pMemLnx->apPages[iPage]);
                 rtR0MemObjDelete(&pMemLnx->Core);
-                return VERR_NO_MEMORY;
+                return rcNoMem;
             }
         }
@@ -256,5 +257,5 @@
     {
         rtR0MemObjDelete(&pMemLnx->Core);
-        return VERR_NO_MEMORY;
+        return rcNoMem;
     }
     for (iPage = 0; iPage < cPages; iPage++)
@@ -295,5 +296,5 @@
                     (unsigned long)cb, (unsigned long)uAlignment, rtR0MemObjLinuxOrder(cPages), (unsigned long)page_to_phys(pMemLnx->apPages[0]));
             rtR0MemObjLinuxFreePages(pMemLnx);
-            return VERR_NO_MEMORY;
+            return rcNoMem;
         }
     }
@@ -541,7 +542,9 @@
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)
-    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER, false /* non-contiguous */);
+    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_HIGHUSER,
+                                   false /* non-contiguous */, VERR_NO_MEMORY);
 #else
-    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */);
+    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_PAGE, cb, PAGE_SIZE, GFP_USER,
+                                   false /* non-contiguous */, VERR_NO_MEMORY);
 #endif
     if (RT_SUCCESS(rc))
@@ -570,15 +573,18 @@
 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
     /* ZONE_DMA32: 0-4GB */
-    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32, false /* non-contiguous */);
+    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA32,
+                                   false /* non-contiguous */, VERR_NO_LOW_MEMORY);
     if (RT_FAILURE(rc))
 #endif
 #ifdef RT_ARCH_AMD64
         /* ZONE_DMA: 0-16MB */
-        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA, false /* non-contiguous */);
+        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_DMA,
+                                       false /* non-contiguous */, VERR_NO_LOW_MEMORY);
 #else
 # ifdef CONFIG_X86_PAE
 # endif
         /* ZONE_NORMAL: 0-896MB */
-        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER, false /* non-contiguous */);
+        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_LOW, cb, PAGE_SIZE, GFP_USER,
+                                       false /* non-contiguous */, VERR_NO_LOW_MEMORY);
 #endif
     if (RT_SUCCESS(rc))
@@ -606,13 +612,16 @@
 #if (defined(RT_ARCH_AMD64) || defined(CONFIG_X86_PAE)) && defined(GFP_DMA32)
     /* ZONE_DMA32: 0-4GB */
-    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32, true /* contiguous */);
+    rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA32,
+                                   true /* contiguous */, VERR_NO_CONT_MEMORY);
     if (RT_FAILURE(rc))
 #endif
 #ifdef RT_ARCH_AMD64
         /* ZONE_DMA: 0-16MB */
-        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA, true /* contiguous */);
+        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_DMA,
+                                       true /* contiguous */, VERR_NO_CONT_MEMORY);
 #else
         /* ZONE_NORMAL (32-bit hosts): 0-896MB */
-        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER, true /* contiguous */);
+        rc = rtR0MemObjLinuxAllocPages(&pMemLnx, RTR0MEMOBJTYPE_CONT, cb, PAGE_SIZE, GFP_USER,
+                                       true /* contiguous */, VERR_NO_CONT_MEMORY);
 #endif
     if (RT_SUCCESS(rc))
@@ -658,5 +667,6 @@
 
     rc = rtR0MemObjLinuxAllocPages(&pMemLnx, enmType, cb, uAlignment, fGfp,
-                                   enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */);
+                                   enmType == RTR0MEMOBJTYPE_PHYS /* contiguous / non-contiguous */,
+                                   VERR_NO_PHYS_MEMORY);
     if (RT_FAILURE(rc))
         return rc;
Index: /trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp	(revision 39743)
+++ /trunk/src/VBox/Runtime/r0drv/nt/memobj-r0drv-nt.cpp	(revision 39744)
@@ -273,5 +273,5 @@
             if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) >= _4G)
             {
-                rc = VERR_NO_MEMORY;
+                rc = VERR_NO_LOW_MEMORY;
                 break;
             }
Index: /trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp
===================================================================
--- /trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp	(revision 39743)
+++ /trunk/src/VBox/Runtime/r0drv/os2/memobj-r0drv-os2.cpp	(revision 39744)
@@ -167,5 +167,6 @@
     }
     rtR0MemObjDelete(&pMemOs2->Core);
-    return RTErrConvertFromOS2(rc);
+    rc = RTErrConvertFromOS2(rc);
+    return rc == VERR_NO_MEMORY ? VERR_NO_LOW_MEMORY : rc;
 }
 
