[Memory Leak] s_singletonInstance
SecureBuffer opened this issue · 1 comments
the pointer for s_singletonInstance is created under 's_singletonInstance = new Navigation();' but is never deleted after useage.
In C++, you don't necessarily have to delete a new class explicitly. In C++, the new operator is used to allocate memory for a dynamically created object, and the delete operator is used to free that memory when you are done with the object.
When you create an object using new, it is stored on the heap, and you are responsible for managing the memory associated with that object. Failing to delete the dynamically allocated object can result in memory leaks, which means that the memory will not be released back to the system, and your program's memory usage will increase over time.
added this to fix the memory leak.
MMAP::MMapFactory::createOrGetMMapManager()->~MMapManager(); if (s_singletonInstance != NULL) { delete[] s_singletonInstance; }