Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 137
Registered: ‎12-22-2010
My Device: Curve 8520
My Carrier: Software Developer

Writing a 15 MB file with Web Works and prevent memory leak

Hi,

 

I have a bad issue in my app. If my user try to write a file around 15 MB with blackberry Playbook the apps crash (without message). A little research shows me, that the app pulls up to 500 MB memory while using the stringToBlob function. My idea was to split the call into chunks.

 

var blobs: Blob[] = [];
var pos: number = 0;
var len: number = data.length;                

while (pos < len) {                    
   blobs[blobs.length] = blackberry.utils.stringToBlob(data.substr(pos, CHUNK));
   pos = blobs.length * CHUNK;
}

blackberry.io.file.saveFile(filePath, new Blob(blobs)); // new Blob does not work ... how to concat

I can reduce the memory usage this way ... but I cannot write the file because I don't see a way to concat the blobs again or append blobs to existing file.

 

Any ideas?

Developer
Posts: 153
Registered: ‎12-03-2012
My Device: PP
My Carrier: base(kpn)/BE, t-mobile/PL

Re: Writing a 15 MB file with Web Works and prevent memory leak

1) check if there is a size limit for a string length:

http://developer.blackberry.com/html5/apis/blackberry.utils.html#.stringToBlob

2) maybe this link will help you:

http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file-appending

--
Regards,
Pawel Gorny
my apps: http://pawelgorny.com/
PGpgp, Your Reply, Anagrammatist, Texas Hold'em Odds Calculator, Contacts to CSV
If your issue has been solved, please resolve it by marking "Accept as Solution"
Developer
Posts: 137
Registered: ‎12-22-2010
My Device: Curve 8520
My Carrier: Software Developer

Re: Writing a 15 MB file with Web Works and prevent memory leak

1) There is no documented limit for playbook. I cannot write smaller chunks becaue there is no FileWriter in PB Smiley Sad

 

2) new Blob() does not work on Playbook

Highlighted
Retired
Posts: 856
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: Writing a 15 MB file with Web Works and prevent memory leak

I think you'll have to switch to either the HTML5 file system apis to do smaller writes and seek to the location to write to, or modify your PlayBook WebWorks SDK to add seeking options to the existing file methods. The current ones are just not sophisticated enough to do what you need.

Tim Windsor
Open Source Technical Lead