From 4caecf120fabad8b66450df9e36b04e7274ae02d Mon Sep 17 00:00:00 2001 From: Sebastian Ertz Date: Sat, 27 Jun 2026 10:18:12 +0200 Subject: [PATCH 1/2] hulog.cpp/humalloc.cpp: Use inttypes --- src/hulog.cpp | 8 ++++---- src/humalloc.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hulog.cpp b/src/hulog.cpp index 3ab26d6..35f40c7 100644 --- a/src/hulog.cpp +++ b/src/hulog.cpp @@ -316,7 +316,7 @@ void log_event(int event, void* ptr, size_t size) log_print_callstack(f, callstack_depth, callstack); - fprintf(f, "%s Address %p is a block of size %ld free'd at:\n", + fprintf(f, "%s Address %p is a block of size %zu free'd at:\n", hu_prefix, ptr, allocation->second.size); log_print_callstack(f, allocation->second.free_callstack_depth, @@ -378,7 +378,7 @@ void hu_sig_handler(int sig, siginfo_t* si, void* /*ucontext*/) found = true; size_t offset = (char*)ptr - ((char*)allocation->second.ptr + allocation->second.size); - fprintf(f, "%s Address %p is %ld bytes after a block of size %ld alloc'd at:\n", + fprintf(f, "%s Address %p is %zu bytes after a block of size %zu alloc'd at:\n", hu_prefix, ptr, offset, allocation->second.size); log_print_callstack(f, allocation->second.callstack_depth, allocation->second.callstack); @@ -397,7 +397,7 @@ void hu_sig_handler(int sig, siginfo_t* si, void* /*ucontext*/) found = true; size_t offset = (char*)ptr - ((char*)allocation->second.ptr + allocation->second.size); - fprintf(f, "%s Address %p is %ld bytes after a block of size %ld free'd at:\n", + fprintf(f, "%s Address %p is %zu bytes after a block of size %zu free'd at:\n", hu_prefix, ptr, offset, allocation->second.size); log_print_callstack(f, allocation->second.free_callstack_depth, @@ -413,7 +413,7 @@ void hu_sig_handler(int sig, siginfo_t* si, void* /*ucontext*/) found = true; size_t offset = (char*)ptr - ((char*)allocation->second.ptr); - fprintf(f, "%s Address %p is %ld bytes inside a block of size %ld free'd at:\n", + fprintf(f, "%s Address %p is %zu bytes inside a block of size %zu free'd at:\n", hu_prefix, ptr, offset, allocation->second.size); log_print_callstack(f, allocation->second.free_callstack_depth, diff --git a/src/humalloc.cpp b/src/humalloc.cpp index 6687114..5e8aaa4 100644 --- a/src/humalloc.cpp +++ b/src/humalloc.cpp @@ -11,6 +11,7 @@ /* ----------- Includes ------------------------------------------ */ #include #include +#include #include #include #include @@ -103,7 +104,7 @@ static int hu_mprotect(void* addr, size_t len, int prot) int rv = mprotect(addr, len, prot); if (rv != 0) { - fprintf(stderr, "heapusage error: mprotect(%p, %ld, %d) failed errno %d\n", + fprintf(stderr, "heapusage error: mprotect(%p, %zu, %d) failed errno %d\n", addr, len, prot, errno); #if defined(__linux__) @@ -117,9 +118,9 @@ static int hu_mprotect(void* addr, size_t len, int prot) if (callcount > (max_map_count / 2)) { fprintf(stderr, - "max_map_count=%ld mprotect_count=%ld, try increasing max_map_count, ex:\n", + "max_map_count=%" PRIu64 " mprotect_count=%" PRIu64 ", try increasing max_map_count, ex:\n", max_map_count, callcount); - fprintf(stderr, "sudo sh -c \"echo %ld > /proc/sys/vm/max_map_count\"\n", + fprintf(stderr, "sudo sh -c \"echo %" PRIu64 " > /proc/sys/vm/max_map_count\"\n", (2 * max_map_count)); exit(1); } From 1d30d220b398dc08fc721e45291c1112d993c203 Mon Sep 17 00:00:00 2001 From: Kristofer Berggren Date: Sun, 28 Jun 2026 13:37:35 +0800 Subject: [PATCH 2/2] follow-up to 4caecf1 - bump version --- src/heapusage | 2 +- src/heapusage.1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/heapusage b/src/heapusage index e9933d4..1466868 100755 --- a/src/heapusage +++ b/src/heapusage @@ -5,7 +5,7 @@ # # heapusage is distributed under the BSD 3-Clause license, see LICENSE for details. -HU_VER="2.37" +HU_VER="2.38" showusage() { diff --git a/src/heapusage.1 b/src/heapusage.1 index 93b7a1c..1a5e296 100644 --- a/src/heapusage.1 +++ b/src/heapusage.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man. -.TH HEAPUSAGE "1" "June 2026" "heapusage v2.37" "User Commands" +.TH HEAPUSAGE "1" "June 2026" "heapusage v2.38" "User Commands" .SH NAME heapusage \- find memory leaks in applications .SH SYNOPSIS