Does scrollView remove its contents when it is removed using removeSelf()

Hi, 

Basic question. If I have a simple scrollView and then insert a couple newTexts in it and then proceed to use 

scrollView:removeSelf() scrollView = nil

to remove the scrollView, would its contents be removed properly or would they linger around causing memory leak?

In other words, before removing a scrollView do I need to remove the objects in it one by one or would it take care of its contents as it gets removed?

Thanks for this information. 

Regards,

Kerem

I’m pretty sure that when removeSelf() is run on a display.newGroup() it loops through and removes the objects like it should.  Since a scrollView is at its heart  a display.newContainer() (which should have the same behavior), it should.  But you always can loop through your items and remove them yourself to be safe.

Thanks for your kind answer. Would it be possible to get a definite answer from the engineers? In the spirit of 10x I would like to avoid unnecessary code if possible if the scrollView is removing its group contents anyways. Thank you very much. 

Given it’s the weekend, you probably could allocate your scrollView, load it up, print your memory usage.  remove the scrollView, run garbage collection and check your memory usage and get an answer faster than I will get back from engineering. 

Its ok. I’ll wait till the weekdays. I think its better that we get a definitive Corona Labs response on this matter. Thanks.

I just looked through the source and it does remove it’s children.  It’s part of the core widget object.

Rob

Super. Thanks for confirming that. Most appreciated. 

I’m pretty sure that when removeSelf() is run on a display.newGroup() it loops through and removes the objects like it should.  Since a scrollView is at its heart  a display.newContainer() (which should have the same behavior), it should.  But you always can loop through your items and remove them yourself to be safe.

Thanks for your kind answer. Would it be possible to get a definite answer from the engineers? In the spirit of 10x I would like to avoid unnecessary code if possible if the scrollView is removing its group contents anyways. Thank you very much. 

Given it’s the weekend, you probably could allocate your scrollView, load it up, print your memory usage.  remove the scrollView, run garbage collection and check your memory usage and get an answer faster than I will get back from engineering. 

Its ok. I’ll wait till the weekdays. I think its better that we get a definitive Corona Labs response on this matter. Thanks.

I just looked through the source and it does remove it’s children.  It’s part of the core widget object.

Rob

Super. Thanks for confirming that. Most appreciated. 

Just ran into this and seems there is a bug. The objects inserted into a scrollView get added to self._collectorGroup , but this collectorGroup itself is never removed in the _finalize function.

Thanks for looking into this. This is what I was wondering about hence my initial question. 

Seems pretty serious, if you have a scrollView on any scene, the widgets inserted into it leave a memory leak

Just ran into this and seems there is a bug. The objects inserted into a scrollView get added to self._collectorGroup , but this collectorGroup itself is never removed in the _finalize function.

Thanks for looking into this. This is what I was wondering about hence my initial question. 

Seems pretty serious, if you have a scrollView on any scene, the widgets inserted into it leave a memory leak

so what should I do?