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

CreatObject return of invalid

I thought that CreatObject was to return an invalid if the object couldn't be created ?

o = CreateObject( "roArray", 100000, 1 )
for i=0 to 100000
x = CreateObject( "roArray", 10000, 1 )
if x = invalid exit for
o.push( x )
? i*10000
end for


It just crashes !

This was just for fun.
Need a method to tell the amount of available memory and file space

Roku could add another returned value from RunGarbageCollector() that shows available space
and have GetVolumeInfo() work for the internal file sytems.
0 Kudos
2 REPLIES 2
EnTerr
Roku Guru

Re: CreatObject return of invalid

Ahh, good one - i will mark it for my collection of YAWRRs. Seems to work on all platforms. Here is a shorter version:
BrightScript Debugger> dim reboot[10000, 10000]
Connection closed by foreign host.

About predicting and avoiding impending doom: I am reminded of a great, droll scifi story by Robert Sheckley, "Protection" (i wholeheartedly recommend reading it!):
"Robert Sheckley" wrote:

...the big problem is lesnerizing. I must not lesnerize. Absolutely not. As you can imagine, that hampers me.


PS. @greubel - your suggestions sound reasonable; don't know if they are falling on deaf ears though. Maybe if you describe in more detail your plight (i.e. you are trying to parse/cache big amount of media info or what-have-you), Roku* will pay attention?
0 Kudos
EnTerr
Roku Guru

Re: CreatObject return of invalid

So Roku* -
what's the deal with (to give concrete example) `createObject("roArray", 1234567890, false)` working on fw3 but crashing the box on fw5?

If not enough memory, the right behavior is to return `invalid` (or runtime error) - and that's what old firmware does. New one just blows up instead - a very quick reboot:
$ telnet roku4200 8085
BrightScript Debugger> x = createObject("roArray", 1234567890, false)
Connection closed by foreign host.

$ telnet roku2050 8085
BrightScript Debugger> x = createObject("roArray", 1234567890, false)
BrightScript Debugger> ? x
invalid

(See also belltown's topic viewtopic.php?f=34&t=73863 )
0 Kudos