diff --git a/src/memory_leak_debug.cpp b/src/memory_leak_debug.cpp index 4fc474c..05a8f89 100644 --- a/src/memory_leak_debug.cpp +++ b/src/memory_leak_debug.cpp @@ -123,7 +123,8 @@ void show_top_10_allocations() std::sort(buf, end, [](const auto& a, const auto& b) { return a.allocated_size > b.allocated_size; }); - printf("%I64u total bytes allocated\n", total_allocated); + printf("%I64u total bytes allocated\n\n", total_allocated); + printf("Top 10 allocations:\n\n"); for (TrackedAllocation* p = buf; (p < buf + 10) && (p < end); ++p) { printf("%I64u bytes allocated at:\n", p->allocated_size); @@ -131,6 +132,8 @@ void show_top_10_allocations() } } + printf("\n"); + VirtualFree(buf, 0, MEM_RELEASE); } @@ -300,6 +303,9 @@ bool memory_tracking_stop() if (total_leaks > 0) { printf("%I64u bytes leaked\n\n", total_leaks); } + else { + printf("No memory leaks detected\n\n"); + } SymCleanup(h); diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 89301c4..8547b30 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -2102,7 +2102,7 @@ void SideChain::prune_old_blocks() m_pool->reconnect_to_host(); } - if (cur_time >= m_firstPruneTime + 120) { + if ((cur_time >= m_firstPruneTime + 120) && !m_pool->stopped()) { LOGINFO(0, log::LightGreen() << "[DEV] Synchronization finished successfully, stopping P2Pool now"); #ifdef DEV_TRACK_MEMORY show_top_10_allocations();