got a C++ doubt..
normally Singleton class is written like
static Sing* instance;
static Sing *getInstance;
But this proc can be used only for single thread. not for multi.
Sing* Sing::instance = 0;
if (instance == 0)
instance = new Sing();
In case of singleton, dest never gets called. So, mem allocated using new does not have corresponding delete. So, this can lead to mem leak.
Hence, i heard this can be solved using
static Sing instance;
Why so. Why cant it be used for multithreading??