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: 
xtr33me
Visitor

How to get objects memory address space?

Is there a way to print the address space that an object is using? I am trying to troubleshoot an issue I am running into and I am trying to see if an object is calling its own function or if due to the public nature of roku, I am calling a global function on a single object x number of times. So I essentially just want to print the address of the object I am making the call from and what it is actually being called on. Is this at all possible to do in roku?

In my case I have one singleton which then contains an array of another class that can be instantiated x number of times. Due to this I couldn't make it a singleton, but I tried always having it make calls to its this object, however I think I am running into an issue when I am having my singleton manage callbacks.

Simpy put, can I print the address space of an object on the roku and if so how 🙂 TIA!
0 Kudos
3 REPLIES 3
EnTerr
Roku Guru

Re: How to get objects memory address space?

No. 🙂
At least to my knowledge there is no way.
But i can offer you a workaround: what you are asking is how to uniquely identify objects, so you can distinguish them. Manually add an id field to them, in the constructor function - like so:
function objFactory():
this = {
...
id: rnd(0)
...
}
return this
end function
...
obj = objFactory()
? obj.id
0 Kudos
TheEndless
Channel Surfer

Re: How to get objects memory address space?

You can compare function references directly for equality.

But, to answer your question, I don't think there's any way to get a specific memory address. "bsc" will give you the address of every object currently in memory, but I doubt you'll be able to find what you're looking for in what that spews out.
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
xtr33me
Visitor

Re: How to get objects memory address space?

Thanks for the responses! EnTerr, I kind of figured I was going to have to do something like this but was hoping I wouldn't 🙂 Thanks again for the help. Sometimes nice to just get a definitive answer.
0 Kudos