2

I'm running a C++ application from a Linux terminal. This application allocates shared memory (using Boost Interprocess).

If I kill the application (Ctrl + c) in the terminal I was expecting a destructor to be called. However, it's not, leaving my shared memory still allocated. Therefore when I go to run again, instead of the shared memory being re-created, the existing memory state is opened. This is undesirable.

Is there a way to get the destructor to be called upon cancelling the application in the terminal?

user997112
  • 29,025
  • 43
  • 182
  • 361

0 Answers0