Proper Button Widget Removal In Storyboard?

I’m curious about proper removal of the new widgets.

I setup a few widget buttons that I believe I’ve handled correctly with inserting them into the createScene view group and later using removeSelf() and nil in exitScene. I call removeAll() in the enterScene of all scenes… But I still have a system memory hit of 100k that lingers?

Hi @nathan311,

Have you made sure to properly clean up your memory not necessarily related to the buttons? Timers, other transitions, Runtime listeners, all global variables, etc.? Did you place the buttons in a “containing table” and forget to clear out those references?

Also, does your memory climb and continue climbing as you navigate from scene to scene with buttons? A small one-time memory jump is not necessarily a warning sign… it’s a continually climbing value which you should be very concerned about.

Brent

Hi Brent,
It is a one time hit. It also seems the type of widget when added i.e. button, switch, etc. each have a one time hit to them. I’ve compared running with them and then commenting them and the require line out. The system mem only stays up with them.

It does make sense to go up on the scene, just odd it lingers. Ultimately for me this is just a test for an options page and being I don’t need them elsewhere in my project it seems like a lot to go up and not seemingly be able to remove. I just wanted to make sure this is expected behavior and I’m not doing something ridiculous.

Hi Nathan,

What I’d suggest is to build a little test project (I guess you’ve already started) consisting of 2-3 scenes with buttons in them. Scene 1 goes to scene 2, to scene 3, and back to 1. When leaving each scene, follow all of the memory cleanup processes that you’re supposed to. Then, run the app and monitor the memory as you navigate around. It’s normal for the memory to go up a bit on launch (obviously). Even if you do a full cycle of the 3 scenes, it might not return exactly to where it was when you launched the app… this is not necessarily alarming or unexpected. What would be alarming would be if the memory is (say) 100 in scene 1, then after one cycle through the scenes it goes to 200, then 300, then 400, etc. etc.

Brent

P.S. - I probably should have asked before… you’re not using global variables or functions, are you?

Brent your great I appreciate the help. I’m just being newbie neurotic about memory. I ran the test on the storyboard template and it’s looking good. Same deal with just an initial hit that never raises again.

Thanks much

Hi @nathan311,

Have you made sure to properly clean up your memory not necessarily related to the buttons? Timers, other transitions, Runtime listeners, all global variables, etc.? Did you place the buttons in a “containing table” and forget to clear out those references?

Also, does your memory climb and continue climbing as you navigate from scene to scene with buttons? A small one-time memory jump is not necessarily a warning sign… it’s a continually climbing value which you should be very concerned about.

Brent

Hi Brent,
It is a one time hit. It also seems the type of widget when added i.e. button, switch, etc. each have a one time hit to them. I’ve compared running with them and then commenting them and the require line out. The system mem only stays up with them.

It does make sense to go up on the scene, just odd it lingers. Ultimately for me this is just a test for an options page and being I don’t need them elsewhere in my project it seems like a lot to go up and not seemingly be able to remove. I just wanted to make sure this is expected behavior and I’m not doing something ridiculous.

Hi Nathan,

What I’d suggest is to build a little test project (I guess you’ve already started) consisting of 2-3 scenes with buttons in them. Scene 1 goes to scene 2, to scene 3, and back to 1. When leaving each scene, follow all of the memory cleanup processes that you’re supposed to. Then, run the app and monitor the memory as you navigate around. It’s normal for the memory to go up a bit on launch (obviously). Even if you do a full cycle of the 3 scenes, it might not return exactly to where it was when you launched the app… this is not necessarily alarming or unexpected. What would be alarming would be if the memory is (say) 100 in scene 1, then after one cycle through the scenes it goes to 200, then 300, then 400, etc. etc.

Brent

P.S. - I probably should have asked before… you’re not using global variables or functions, are you?

Brent your great I appreciate the help. I’m just being newbie neurotic about memory. I ran the test on the storyboard template and it’s looking good. Same deal with just an initial hit that never raises again.

Thanks much