开发者

Creating two or more singleton

I created 3 singleton classes for making it easy to access the objects and methods. I used a class for having url connection and save the data into some objects while other开发者_开发问答 singleton saves to the core data model and the other to synchronize and get values from those classes and store in some objects.

Is it bad programming pattern to have more singleton and does it have some issues with memory management ? Singleton are created once and never released until the app is shut so it may have some memory overloading problem.


Although you could use any number of singleton that required to fit in your requirement but i feel,there must be some limitation on that when they handle large chunk of data, like in your case ,All your singleton class are just service provider to your applications components and handle large chunk of data So you need to do good memory management streagy , like identifying the data which you not required for long , temporary data, and the stored data which your apps require at any time. and release them properly on time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜