If it takes a long time to release memory, then don't do it. This may be a big and time-consuming issue, especially if releasing memory leads to numerous cache misses. OS will do the job (of course, if you are operating on the systems that actually does that).
However, if your destructor does finalization of some resources (for example, unlocking a file or a piece of hardware), and you use "resource acquisition is initialization", you must ensure that the proper destructors are called (for example, those of static objects are called after your main()
function returns). This holds if some of the objects allocated inside your singleton lock resources, too!
In most cases, therefore, it's better to actually write a destructor for such an object and make it release memory optionally.
SSS, who asked the question, decided not to write destructor at all. However, I'd like to argue a bit more that it's not the best solution.
Not freeing a memory for a static object (let's call it "static") is a very subtle optimization that contradicts common sense and how people usually write programs. Your code, allocating memory and merely having no destructor, looks weird. Peers will think that the class is badly written, will tend to look bugs in it (while they're in the other class).
Instead, you should conform to common coding standards which dictate that memory management in C++ should be correct. Do write a destructor and, only after it shows it has a significant boost not to deallocate, wrap the code for it not to be called.
Intent to not release the memory must be explicit.
MySingleton::~MySingleton()
{
#ifndef RELEASE
// The memory will be released by OS when program terminates!
delete ptr1;
delete ptr2;
#endif
}
or even
MySingleton::~MySingleton()
{
// We don't do anything here.
// The memory will be released by OS when program terminates!
}
but destructor is better to persist.