views:

38

answers:

2

Hi all....

can anybody help me out please...

i have a huge object in a model. i made it as a single ton class and returning the object wn other calls.but the object is very big thats y the app is crasing. with out returning how to share the data globally and when to alloc the object and where to dealloc the object. i dont need all the data in object in a viewcontroller ..i need specific data to a view controller from that object...

Thanks.

A: 

You can store a pointer to it in your app delegate and retrieve it using

BlahAppDelegate* delegate = [[UIApplication sharedApplication] delegate];
id bigObject = delegate.bigObject;

Since the app delegate will outlive the view controllers, you shouldn't have to worry about retain and release for it.

A singleton class should work similarly, as long as the singleton instance method (that retrieves the one created instance) calls retain on the instance when before it returns it. When the view is dealloc-ed, make sure you call release on the instance.

Ben Hughes
A: 

i used the singleton object only and it was a memory management problem..now its fine

Thank u all...

rockey