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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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?

0 Kudos
Binge Watcher

Re: Cleaning Orphaned Objects

print RunGarbageCollector()
0 Kudos
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: - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos

Re: Cleaning Orphaned Objects

Generally, Cleaning service should be able to do some basic hoovering, cleaning down worktops and cleaning a toilet in a two-hour period, at a minimum. The important point to remember is that you should always try and make the most out of a two-hour-long cleaning session.

0 Kudos