diff options
-rw-r--r-- | allchblk.c | 4 | ||||
-rw-r--r-- | alloc.c | 10 | ||||
-rw-r--r-- | headers.c | 2 | ||||
-rw-r--r-- | include/private/gc_priv.h | 5 | ||||
-rw-r--r-- | mark.c | 2 | ||||
-rw-r--r-- | misc.c | 4 | ||||
-rw-r--r-- | os_dep.c | 6 | ||||
-rw-r--r-- | win32_threads.c | 2 |
8 files changed, 19 insertions, 16 deletions
@@ -841,9 +841,9 @@ GC_allochblk_nth(size_t sz, int kind, unsigned flags, int n, int may_split) if (++GC_large_alloc_warn_suppressed >= GC_large_alloc_warn_interval) { WARN("Repeated allocation of very large block " - "(appr. size %" WARN_PRIdPTR "):\n" + "(appr. size %" WARN_PRIuPTR " KiB):\n" "\tMay lead to memory leak and poor performance\n", - size_needed); + (word)size_needed >> 10); GC_large_alloc_warn_suppressed = 0; } size_avail = orig_avail; @@ -1529,14 +1529,13 @@ GC_INNER GC_bool GC_expand_hp_inner(word n) } space = GET_MEM(bytes); if (EXPECT(NULL == space, FALSE)) { - WARN("Failed to expand heap by %" WARN_PRIdPTR " bytes\n", - (word)bytes); + WARN("Failed to expand heap by %" WARN_PRIuPTR " KiB\n", bytes >> 10); return FALSE; } GC_add_to_our_memory((ptr_t)space, bytes); GC_last_heap_growth_gc_no = GC_gc_no; GC_INFOLOG_PRINTF("Grow heap to %lu KiB after %lu bytes allocated\n", - TO_KiB_UL(GC_heapsize + (word)bytes), + TO_KiB_UL(GC_heapsize + bytes), (unsigned long)GC_bytes_allocd); /* Adjust heap limits generously for blacklisting to work better. */ @@ -1708,7 +1707,10 @@ GC_INNER GC_bool GC_collect_or_expand(word needed_blocks, GC_gcollect_inner(); } else { # if !defined(AMIGA) || !defined(GC_AMIGA_FASTALLOC) - WARN("Out of Memory! Heap size: %" WARN_PRIdPTR " MiB." +# ifdef USE_MUNMAP + GC_ASSERT(GC_heapsize >= GC_unmapped_bytes); +# endif + WARN("Out of Memory! Heap size: %" WARN_PRIuPTR " MiB." " Returning NULL!\n", (GC_heapsize - GC_unmapped_bytes) >> 20); # endif RESTORE_CANCEL(cancel_state); @@ -140,7 +140,7 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes) result = (ptr_t)GET_MEM(bytes_to_get); if (EXPECT(NULL == result, FALSE)) { WARN("Out of memory - trying to allocate requested amount" - " (%" WARN_PRIdPTR " bytes)...\n", (word)bytes); + " (%" WARN_PRIuPTR " bytes)...\n", bytes); bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes); result = (ptr_t)GET_MEM(bytes_to_get); if (result != NULL) { diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 9d63c2de..c93710be 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -734,7 +734,7 @@ EXTERN_C_BEGIN /* Print warning message, e.g. almost out of memory. */ /* The argument (if any) format specifier should be: */ -/* "%s", "%p" or "%"WARN_PRIdPTR. */ +/* "%s", "%p", "%"WARN_PRIdPTR or "%"WARN_PRIuPTR. */ #define WARN(msg, arg) \ (*GC_current_warn_proc)((/* no const */ char *)("GC Warning: " msg), \ (word)(arg)) @@ -746,8 +746,9 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc; /* client side, so non-standard print type modifiers (like MS "I64d") */ /* should be avoided here if possible. */ #ifndef WARN_PRIdPTR - /* Assume sizeof(void *) == sizeof(long) (or a little-endian machine) */ + /* Assume sizeof(void *) == sizeof(long) or a little-endian machine. */ # define WARN_PRIdPTR "ld" +# define WARN_PRIuPTR "lu" #endif /* A tagging macro (for a code static analyzer) to indicate that the */ @@ -1204,7 +1204,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 { - WARN("Failed to grow mark stack to %" WARN_PRIdPTR " frames\n", n); + WARN("Failed to grow mark stack to %" WARN_PRIuPTR " frames\n", n); } } else if (NULL == new_stack) { GC_err_printf("No space for mark stack\n"); @@ -2046,8 +2046,8 @@ GC_API void GC_CALL GC_enable(void) GC_ASSERT(GC_dont_gc != 0); /* ensure no counter underflow */ GC_dont_gc--; if (!GC_dont_gc && GC_heapsize > GC_heapsize_on_gc_disable) - WARN("Heap grown by %" WARN_PRIdPTR " bytes while GC was disabled\n", - GC_heapsize - GC_heapsize_on_gc_disable); + WARN("Heap grown by %" WARN_PRIuPTR " KiB while GC was disabled\n", + (GC_heapsize - GC_heapsize_on_gc_disable) >> 10); UNLOCK(); } @@ -249,7 +249,7 @@ GC_INNER const char * GC_get_maps(void) if (maps_size > old_maps_size) { /* This might be caused by e.g. thread creation. */ WARN("Unexpected asynchronous /proc/self/maps growth" - " (to %" WARN_PRIdPTR " bytes)\n", maps_size); + " (to %" WARN_PRIuPTR " bytes)\n", maps_size); } # endif } while (maps_size >= maps_buf_sz @@ -3703,8 +3703,8 @@ GC_INLINE void GC_proc_read_dirty(GC_bool output_unneeded) size_t new_size = 2 * GC_proc_buf_size; char *new_buf; - WARN("/proc read failed: GC_proc_buf_size= %" WARN_PRIdPTR "\n", - (signed_word)GC_proc_buf_size); + WARN("/proc read failed: GC_proc_buf_size= %" WARN_PRIuPTR "\n", + GC_proc_buf_size); new_buf = GC_scratch_alloc(new_size); if (new_buf != 0) { GC_scratch_recycle_no_gww(bufp, GC_proc_buf_size); diff --git a/win32_threads.c b/win32_threads.c index 3c933d58..70bff927 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -590,7 +590,7 @@ STATIC void GC_delete_thread(thread_id_t id) GC_vthread t = GC_lookup_thread(id); if (EXPECT(NULL == t, FALSE)) { - WARN("Removing nonexistent thread, id= %" WARN_PRIdPTR "\n", id); + WARN("Removing nonexistent thread, id= %" WARN_PRIuPTR "\n", id); } else { GC_delete_gc_thread_no_free(t); } |