I’ve created a class that uses a static NSSet to define some elements shared by every instance of my class.
To define this se i use this code:
myStaticSet = [[NSSet setWithObjects:
@"element one",
@"element two",
nil
]retain];
As you can see i retain the set.
I really can’t understand where i can release myStaticVariable i’m pretty sure that i can’t release it in dealloc… so is there a way to release a static variable ?
//EDIT
It could be a good solution adding a new class method to release static value ?
+(void)cleanstatic{
[mystatic release];
}
and call it when i’m sure i’m done with this class ?
If you’re using a static variable and want to release it, perhaps it shouldn’t be static after all? Is it used throughout the entire lifetime of the application? In that case I’d say you don’t have to bother releasing it.
Otherwise, if you have some common ‘endpoint’ for the code using this variable, that would be the place to get rid of it.