I’m curious what happens with the memory of the objects that I push with [array addObject:object] when I use [array release]
- does addObject copy the pointers?
- do I have to retain the objects ?
- do I have to make a for and release each object then the array?
When you call
arrayretainsobject, thereby incrementing its retain count.Later, when
arrayis sent the messagedealloc, it callsreleaseonobject.To avoid memory leaks, you may have to release
objectafter you add it to thearray, e.g.Make sure you review the Memory Management Programming Guide to be certain that you are not over or under releasing
object.