For a quiz app, I have a class that stores data in arrays that are related to a specific question. When the user moves on to the next question, I need empty data arrays.
Is it better if I did something like
[class release]; //assume that I properly release the arrays and their objects
[class alloc] init];
or
[arrays removeAllObjects];
or an alternate approach not mentioned?
I feel that my code would be simpler if I use the first solution, but I’m worried that I would be taking up too much memory, since the process would be done multiple times.
Go with the simple solution. After you encounter (measure!) problems start to optimize, not before.
There’s really no point in wondering what is more efficient if you don’t see any inefficiency.