退出时不需要清理共享内存

This commit is contained in:
Pan Qiancheng 2025-04-10 11:43:39 +08:00
parent 9b53fcc68d
commit 80199319f0
1 changed files with 8 additions and 8 deletions

View File

@ -25,14 +25,14 @@ __attribute__((destructor)) void cleanup_shared_memory() {
DEBUG_LOG("Log file: %s", LOG_FILE);
DEBUG_LOG("Log out file: %s", LOG_OUT_FILE);
DEBUG_LOG("Shared memory ID: %d", shm_id);
if (shared_config != NULL) {
DEBUG_LOG("Cleaning up shared memory.");
// Detach shared memory segment
if (shmdt(shared_config) == -1) {
perror("shmdt failed");
}
shared_config = NULL;
}
// if (shared_config != NULL) {
// DEBUG_LOG("Cleaning up shared memory.");
// // Detach shared memory segment
// if (shmdt(shared_config) == -1) {
// perror("shmdt failed");
// }
// shared_config = NULL;
// }
#ifdef DEBUG
// print_stacktrace();
#endif