0

I am having some trouble understanding all of ARC. This is a breakdown of my program

https://i.stack.imgur.com/tfRaH.png

I wrote it like this to emphasize that VC1 is more of the 'master screen'...that it doesn't really have variables that change. You type in some values and pass them into the music player which is instantiated The problem is when leaving VC2 and going to the startup screen to select different values the memory just keeps going higher and higher as the cycle continues.

Is this how it's supposed to work? I notice when I go back to the startup screen, all of its values have been reset which tells me that its drawing things as new. Why does memory keep increasing every time I switch between these two screens?

  • How are you going between the two controllers? – rdelmar Aug 29 '13 at 00:29
  • Are you calling `presentViewController` (or some variant) to get from VC1 to VC2? And calling `dismissViewController` to get from VC2 back to VC1? – progrmr Aug 29 '13 at 01:04
  • I am using segues to get between VC1 and VC2 as I need to pass data...also using a segue to get back to VC1, I was not aware there were other ways of moving about. – marc jacbson Aug 29 '13 at 01:21

1 Answers1

1

"Why does memory keep increasing every time I switch between these two screens?"

Probably because you're not actually switching between the two controllers -- the fact that the values are reset when you "go back" to vc1 tells me that you actually instantiating a new instance of vc1 when you "go back". When using segues, you should only use an unwind segue to go back to a previous controller. Other types of segues always instantiate new controllers .

rdelmar
  • 103,982
  • 12
  • 207
  • 218
  • @marcjacbson, I have an explanation of how to do unwind segues in my answer here, http://stackoverflow.com/questions/16158586/app-running-slow-after-loading-viewcontroller-then-unload-about-15-20-times/16160239#16160239 – rdelmar Aug 29 '13 at 01:33