Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
SkipFire
Visitor

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 2
RokuJoel
Binge Watcher

Re: Cleaning Orphaned Objects

print RunGarbageCollector()
0 Kudos
TheEndless
Channel Surfer

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