Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all..

I am confused by thinking how/ when the dealloc in singleton instance get called?

Can any one tell me how to release a static object..

Say...
My code luks like below...
Code:
// staticMyClassObj    is a static-object

+(MyClass *)getMyClassObject
{
	if(staticMyClassObj == nil)
	{
		staticMyClassObj = [[Catalog alloc]init];
		staticMyClassObj.myClassDictionary = [[[NSMutableDictionary alloc] init]autorelease];
		staticMyClassObj.itemsArray = [[[NSMutableArray alloc]init]autorelease];
		
	
	}
	return staticMyClassObj;
}

+(void)setMyClassObject:(MyClass *)MyClassObject
{
	
	if(staticMyClassObj !=MyClassObject)
	{
		[staticMyClassObj release];
		staticMyClassObj = [MyClassObject retain];
		
	}
}

I am just calling [MyClass getMyClasObject].<anyProperty> to set teh values from different files...

However i wnat the data through out the application...

So how to release / dealloc the "staticMyClassObj" before quitting app...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.