Compare commits

..

2 commits

Author SHA1 Message Date
14301c372d Update Changelog.md, version 2.8 2024-11-12 16:33:16 +09:00
293b18e4bf Avoid segfault on exit(...)
Avoids segfault by not freeing the internal structure handling memory
allocations. When the process ends, the OS should reclaim all memory,
even if it isn't free'd during process execution.
2024-11-12 16:32:23 +09:00
3 changed files with 13 additions and 4 deletions

View file

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.7)
project(AnotherMemCheck) project(AnotherMemCheck)
set(AnotherMemCheck_VERSION 2.7) set(AnotherMemCheck_VERSION 2.8)
set(AnotherMemCheck_SOVERSION 2) set(AnotherMemCheck_SOVERSION 2)
set(AnotherMemCheck_SOURCES set(AnotherMemCheck_SOURCES

View file

@ -1,5 +1,11 @@
# Changelog # Changelog
## Version 2.8
Internal refactorings.
Minor change to avoid segfault when program exits with `exit(...)` function.
## Version 2.7 ## Version 2.7
Fix incorrect initialization. Fix incorrect initialization.

View file

@ -217,9 +217,12 @@ namespace SC_AM_Internal {
void exit_handler_stats() { void exit_handler_stats() {
if (SC_AM_Internal::stats != nullptr) { if (SC_AM_Internal::stats != nullptr) {
SC_AM_Internal::stats->print_status(); SC_AM_Internal::stats->print_status();
using SCS_AM_INTERNAL_Stats = SC_AM_Internal::Stats;
SC_AM_Internal::stats->~SCS_AM_INTERNAL_Stats(); // Avoids segfault when program calls `exit(...)`. OS should reclaim memory
SC_AM_Internal::stats = nullptr; // when the process ends even if it isn't free'd here.
//using SCS_AM_INTERNAL_Stats = SC_AM_Internal::Stats;
//SC_AM_Internal::stats->~SCS_AM_INTERNAL_Stats();
//SC_AM_Internal::stats = nullptr;
} }
} }