+ 1
How does Singleton work
I know it's used for loggers but I'm not sure how it works, I would like to know when to use it and when not to use it.
1 Réponse
+ 2
Singleton used to create single object. Suppose there is a class which is accessed by many client so every time object will be create of that class and this object will be store in heap memory. So if there are 1000 client accessing that class then 1000 objects will be store in heap memory which result would be slow performance of the system.
So to avoid this we use singleton.