Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Array size issue
This thread has 5 replies. Displaying all posts.
Post 1 made on Friday January 30, 2009 at 05:03
posts
Long Time Member
Joined:
Posts:
March 2007
40
I am creating an iTunes controller for the 9600 using the protocol exposed by the iTunes which is used by the iPhone Remote App. As part of this, I am pulling back various chunks of data from iTunes such as a complete list of album names or artist names. I connect through an async socket and once all data is received I start to process it (iTunes tells you how many bytes are coming so it is easy to find the end). I hold the album names in an array (size not specified at declaration) and I use the push function to add each new record.

The problem occurs when I pull back more than about 400 album names. The 9600 processes the first 399 right and then essentially reboots. I have tried sorting the album names in different ways so it is not a record issue and I have read the records and printed them without pushing them into an array and it reads all fine. If I chunk the data by passing multiple http requests to iTunes (getting 200 records at a time) and push them into the array this way, I can get through them all without a reboot. Would suggest it is not a memory size issue for the array.

Anyone any ideas or seen this behaviour before? Clearly there is a way round it by sending http request that get limited records but this is just more of a pain!

Regards

Simon
Simon
Post 2 made on Friday January 30, 2009 at 11:32
Jon Welfringer
Long Time Member
Joined:
Posts:
December 2002
175
Without seeing any code, it's hard to say, but I would almost think that there is a memory leak somehow. If you can get 399 records without a reboot, I would put a break in the code to stop there and then check the available free memory.
Post 3 made on Friday January 30, 2009 at 12:07
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
I seem to recall an issue where the max string size was allowed to be 256KB or something like that for System.setGlobal(). Might this be your issue? Sounds like it might as when you do 400 records simultaneously via HTTP, you are likely building ONE LOOOOOOOONG string.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 4 made on Friday January 30, 2009 at 15:07
posts
Long Time Member
Joined:
Posts:
March 2007
40
Thanks for the responses. It is not the string size issue since it works fine if I don't push the responses into an array (just print them to system.print). I have checked the memory (at least by checking free memory in the info pane on the Pronto - is this really the free memory available to code or is this held somewhere else). The total size of the socket data returned is about 600k so it should not be blowing up a 64mb pronto given that my test activity itself is pretty small. Might be a memory leak but it is all in a small self contained while loop which does not create or destroy lots of variables so seems unlikely?

Looks like I will have to stick to the multi-retrieval cludge for the time being!

Thanks

Simon
Simon
Post 5 made on Friday January 30, 2009 at 15:15
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
Well,

Here's the way I approach such a problem.
0. Create a standalone configuration (new one with No network, etc)
1. Build a string that you think will fail.
2. Add string to the array multiple times in an effort to reproduce problem.
3. Download to remote and test.
4. Save XCF file.
5. If problem occurs, zip XCF and ship it to prontoteam at philips dot com with an email body containing problem description.

6. Please also email ONLY the small XCF to me as I want to see JS source code line # of the problem that is available when using Barry's debug tool and docking station mod.

If you are unable to reproduce this problem in this manner, then it is likely that the "data" (from IPod) you are using may string UTF-8 or Unicode issues which may be throwing exception on panel and causing reboot. In that case, you will be forced to isolate the string causing the problem (dump the hex codes).
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 6 made on Friday January 30, 2009 at 15:42
posts
Long Time Member
Joined:
Posts:
March 2007
40
Thanks for the idea Lyndel. I will give it a go. What do you think might be the UTF8 issue? All I am doing is reading a string using a substr() command and then pushing it into an array. Ergo, it really looks like a series of bytes at this point.

Simon
Simon


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse