Index: /trunk/src/VBox/VMM/PGMPhys.cpp
===================================================================
--- /trunk/src/VBox/VMM/PGMPhys.cpp	(revision 6154)
+++ /trunk/src/VBox/VMM/PGMPhys.cpp	(revision 6155)
@@ -411,23 +411,26 @@
     Log(("pgmr3PhysGrowRange: allocate chunk of size 0x%X at %VGp\n", PGM_DYNAMIC_CHUNK_SIZE, GCPhys));
 
-    unsigned    cPages = PGM_DYNAMIC_CHUNK_SIZE >> PAGE_SHIFT;
-    rc = SUPPageAlloc(cPages, &pvRam);
-    if (VBOX_SUCCESS(rc))
-    {
+    unsigned cPages = PGM_DYNAMIC_CHUNK_SIZE >> PAGE_SHIFT;
+
+    for (;;)
+    {
+        rc = SUPPageAlloc(cPages, &pvRam);
+        if (VBOX_SUCCESS(rc))
+        {
+
+            rc = MMR3PhysRegisterEx(pVM, pvRam, GCPhys, PGM_DYNAMIC_CHUNK_SIZE, 0, MM_PHYS_TYPE_DYNALLOC_CHUNK, "Main Memory");
+            if (VBOX_SUCCESS(rc))
+                return rc;
+
+            SUPPageFree(pvRam, cPages);
+        }
+
         VMSTATE enmVMState = VMR3GetState(pVM);
-
-        rc = MMR3PhysRegisterEx(pVM, pvRam, GCPhys, PGM_DYNAMIC_CHUNK_SIZE, 0, MM_PHYS_TYPE_DYNALLOC_CHUNK, "Main Memory");
-        if (    VBOX_SUCCESS(rc)
-            ||  enmVMState != VMSTATE_RUNNING)
-        {
-            if (VBOX_FAILURE(rc))
-            {
-                AssertMsgFailed(("Out of memory while trying to allocate a guest RAM chunk at %VGp!\n", GCPhys));
-                LogRel(("PGM: Out of memory while trying to allocate a guest RAM chunk at %VGp (VMstate=%s)!\n", GCPhys, VMR3GetStateName(enmVMState)));
-            }
+        if (enmVMState != VMSTATE_RUNNING)
+        {
+            AssertMsgFailed(("Out of memory while trying to allocate a guest RAM chunk at %VGp!\n", GCPhys));
+            LogRel(("PGM: Out of memory while trying to allocate a guest RAM chunk at %VGp (VMstate=%s)!\n", GCPhys, VMR3GetStateName(enmVMState)));
             return rc;
         }
-
-        SUPPageFree(pvRam, cPages);
 
         LogRel(("pgmr3PhysGrowRange: out of memory. pause until the user resumes execution.\n"));
@@ -444,8 +447,5 @@
         /* Retry */
         LogRel(("pgmr3PhysGrowRange: VM execution resumed -> retry.\n"));
-        return pgmr3PhysGrowRange(pVM, GCPhys);
-    }
-    LogRel(("pgmr3PhysGrowRange %VGp SUPPageAlloc %x pages failed with %Vrc\n", GCPhys, cPages, rc));
-    return rc;
+    }
 }
 
