From 659e5598f4a65b4673773550f92d7f93b6f2308a Mon Sep 17 00:00:00 2001 From: Clive Blackledge Date: Fri, 3 Oct 2025 01:10:17 -0700 Subject: [PATCH] Added more logging around packet history, to show where memory is allocated. --- src/mesh/PacketHistory.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mesh/PacketHistory.cpp b/src/mesh/PacketHistory.cpp index 0c3736faf..af648807f 100644 --- a/src/mesh/PacketHistory.cpp +++ b/src/mesh/PacketHistory.cpp @@ -25,6 +25,8 @@ PacketHistory::PacketHistory(uint32_t size) size = PACKETHISTORY_MAX; // Use default size if invalid } + LOG_DEBUG("Packet History - pre-alloc heap %u psram %u", memGet.getFreeHeap(), memGet.getFreePsram()); + // Allocate memory for the recent packets array recentPacketsCapacity = size; if (has_psram()) { @@ -33,6 +35,8 @@ PacketHistory::PacketHistory(uint32_t size) if (recentPackets) { memset(recentPackets, 0, sizeof(PacketRecord) * recentPacketsCapacity); recentPacketsInPsram = true; + LOG_DEBUG("Packet History - allocated %u entries in PSRAM, free heap %u psram %u", recentPacketsCapacity, + memGet.getFreeHeap(), memGet.getFreePsram()); } else { LOG_WARN("Packet History - PSRAM allocation failed, falling back to DRAM"); } @@ -50,6 +54,8 @@ PacketHistory::PacketHistory(uint32_t size) // Initialize the recent packets array to zero memset(recentPackets, 0, sizeof(PacketRecord) * recentPacketsCapacity); + LOG_DEBUG("Packet History - allocated %u entries in DRAM, free heap %u psram %u", recentPacketsCapacity, + memGet.getFreeHeap(), memGet.getFreePsram()); } }