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.
This commit is contained in:
parent
33d3adba3f
commit
293b18e4bf
1 changed files with 6 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue