Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

Cleaning Orphaned Objects

Is there a way to get a list of what the orphaned objects are on exit? As a professional developer I'm getting a little annoyed by the GC message and I'm sure it doesn't hurt much of anything and that they get cleaned up anyway, but if I know what those are maybe I can track them down and clean them up sooner just to make my code better and maybe even perform better.

Also, I am guessing that a few of them are things in global m, is there a way to clear that?

Thanks.
0 Kudos
2 Replies
Highlighted
Roku Employee
Roku Employee

Re: Cleaning Orphaned Objects

print RunGarbageCollector()
0 Kudos
Highlighted
Level 9

Re: Cleaning Orphaned Objects

"RokuJoel" wrote:
print RunGarbageCollector()

I believe that will only return the count of orphaned objects, not what they are.

@SkipFire, in my experience, any time you exit the channel with the home button, you're going to have orphaned objects, because the screen stack doesn't have an opportunity to close cleanly. There is a second or two before complete termination as the box closes the screens where some cleanup could be executed to clear any content lists you have referenced, but it's hit or miss (particularly if you have an roAudioPlayer instance open). As for clearing the global m, any function not called within the context of an object/associative array has access to the global m, so you could just create a standalone function to do that cleanup.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos