]> granicus.if.org Git - gc/commitdiff
Replace GC_COND_LOG_PRINTF calls with WARN for allocation failure messages
authorIvan Maidanski <ivmai@mail.ru>
Tue, 11 Dec 2012 16:17:16 +0000 (20:17 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 11 Dec 2012 16:17:16 +0000 (20:17 +0400)
* alloc.c (GC_expand_hp_inner): Replace GC_COND_LOG_PRINTF call to
WARN() call (with WARN_PRIdPTR argument type format specifier) for the
message about failure.
* headers.c (GC_scratch_alloc): Likewise.
* mark.c (GC_mark_some, alloc_mark_stack): Likewise.

alloc.c
headers.c
mark.c

diff --git a/alloc.c b/alloc.c
index 8a64de136c59d129bb64cd7c304ab536fb0df07b..37ad645e3550c77e67e231ccde138b531dcd7649 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -1162,8 +1162,7 @@ GC_INNER GC_bool GC_expand_hp_inner(word n)
     space = GET_MEM(bytes);
     GC_add_to_our_memory((ptr_t)space, bytes);
     if (space == 0) {
-        GC_COND_LOG_PRINTF("Failed to expand heap by %lu bytes\n",
-                           (unsigned long)bytes);
+        WARN("Failed to expand heap by %" WARN_PRIdPTR " bytes\n", bytes);
         return(FALSE);
     }
     GC_COND_LOG_PRINTF(
index d650fe7876de9b0481f1f7c006364ab51289fb36..8e92e3840290986ae5fdf79aad3045880a66113f 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -144,7 +144,7 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
         result = (ptr_t)GET_MEM(bytes_to_get);
         GC_add_to_our_memory(result, bytes_to_get);
         if (result == 0) {
-            GC_COND_LOG_PRINTF("Out of memory - trying to allocate less\n");
+            WARN("Out of memory - trying to allocate less\n", 0);
             scratch_free_ptr -= bytes;
             bytes_to_get = bytes;
 #           ifdef USE_MMAP
diff --git a/mark.c b/mark.c
index 94f5dd0884d60af260e59543dfc109e95d33aeef..08130d494402b98c4cf560a80ab9d5ef342839a2 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -565,8 +565,8 @@ static void alloc_mark_stack(size_t);
 
 handle_ex:
     /* Exception handler starts here for all cases. */
-      GC_COND_LOG_PRINTF(
-          "Caught ACCESS_VIOLATION in marker; memory mapping disappeared\n");
+      WARN("Caught ACCESS_VIOLATION in marker;"
+           " memory mapping disappeared\n", 0);
 
       /* We have bad roots on the stack.  Discard mark stack.   */
       /* Rescan from marked objects.  Redetermine roots.        */
@@ -1221,8 +1221,7 @@ static void alloc_mark_stack(size_t n)
           GC_COND_LOG_PRINTF("Grew mark stack to %lu frames\n",
                              (unsigned long)GC_mark_stack_size);
         } else {
-          GC_COND_LOG_PRINTF("Failed to grow mark stack to %lu frames\n",
-                             (unsigned long)n);
+          WARN("Failed to grow mark stack to %" WARN_PRIdPTR " frames\n", n);
         }
     } else {
         if (new_stack == 0) {