summaryrefslogtreecommitdiff
path: root/allchblk.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-31 21:27:32 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-11-01 00:50:08 +0300
commit2343f553de8e127eb8540c5044d355dc5fb490cd (patch)
treef41632cce4bb5df45669071f00d756e95de740ee /allchblk.c
parentc0e2c507f11e43f043a866514b5b75c60f71dc53 (diff)
downloadbdwgc-2343f553de8e127eb8540c5044d355dc5fb490cd.tar.gz
Fix negative heap size values reported in WARN
Issue #496 (bdwgc). WARN_PRIuPTR is now used to print unsigned values in WARN() calls. Also, byte values are replaced with KiB ones in some WARN() calls. * allchblk.c (GC_allochblk_nth): Use WARN_PRIuPTR specifier instead of WARN_PRIdPTR. * alloc.c (GC_expand_hp_inner, GC_collect_or_expand): Likewise. * headers.c (GC_scratch_alloc): Likewise. * mark.c (alloc_mark_stack): Likewise. * misc.c (GC_enable): Likewise. * os_dep.c [NEED_PROC_MAPS] (GC_get_maps): Likewise. * os_dep.c [PROC_VDB] (GC_proc_read_dirty): Likewise. * win32_threads.c (GC_delete_thread): Likewise. * allchblk.c (GC_allochblk_nth): Print KiB value instead of in bytes in WARN message. * alloc.c (GC_expand_hp_inner): Likewise. * misc.c (GC_enable): Likewise. * alloc.c (GC_expand_hp_inner): Remove unneeded cast of bytes to word. * headers.c (GC_scratch_alloc): Likewise. * alloc.c [(!AMIGA || !GC_AMIGA_FASTALLOC) && USE_MUNMAP] (GC_collect_or_expand): Add assertion to indicate that there is no underflow in GC_heapsize-GC_unmapped_bytes. * include/private/gc_priv.h (WARN): Update comment. * include/private/gc_priv.h [!WARN_PRIdPTR] (WARN_PRIuPTR): Define.
Diffstat (limited to 'allchblk.c')
-rw-r--r--allchblk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/allchblk.c b/allchblk.c
index a0a3f313..d04a7008 100644
--- a/allchblk.c
+++ b/allchblk.c
@@ -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;