BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 08-10-2005, 09:42 AM   #1
abx
New Member
 
Join Date: Aug 2005
Model: 7290
Carrier: VF
Posts: 6
Default Problem with large Strings

Please Login to Remove!

Hi @ll,

I got a Problem with large Strings. I store a lot of Strings in a Vector in Persistent Store. From time to time I need to Mail the results, but I always get an OutOfMemory Error :(
Code:
        // data is the vector
        StringBuffer dataStr = new StringBuffer(130000);
        for (Enumeration el=data.elements(); el.hasMoreElements(); ) {
            dataStr.append((String)el.nextElement() + "\n");
        }
        // own function to send mails
        sendMail("user@domain.tld", "subject", dataStr.toString());
Is there any max size of Strings?

thx,
abx
Offline  
Old 08-10-2005, 08:23 PM   #2
pgifford
Knows Where the Search Button Is
 
Join Date: Aug 2005
Model: 7100t
Posts: 20
Default

Page 23 of the Developer Guide (vol 1) says to avoid using enumerations as it creates garbage. Maybe dumping the enumeration will help.

Paul
__________________
--------------------------------
Need a gmail invitation? PM me with your e-mail address. Gmail has free pop access, perfect for the BlackBerry!
Offline  
Old 08-13-2005, 02:57 PM   #3
arconsulting
Thumbs Must Hurt
 
Join Date: Aug 2004
Location: Metro NYC
Posts: 175
Default

I don't know if there is a size limit on StringBuffer().

But, I would strongly argue against sending 130k emails. RIM's recommendation is to limit data transfers to 2k in size.
__________________
-- Aric Rosenbaum
BlackBerry consulting, BlackBerry development
www.arconsultinginc.com
BlackBerry consulting and development (RIM SI Partner)
Offline  
Old 08-16-2005, 03:36 PM   #4
DaHunter
Knows Where the Search Button Is
 
Join Date: Aug 2005
Model: Lots
Carrier: Rogers
Posts: 21
Default

The max size for a String or byte array is 64k.

DaHunter
Offline  
Old 08-18-2005, 05:16 AM   #5
abx
New Member
 
Join Date: Aug 2005
Model: 7290
Carrier: VF
Posts: 6
Default

Thx for all answers. I also find the reason in "Memory best practices for the BlackBerry Java Development Environment"
Quote:
Note: Byte arrays cannot be larger than 128 KB on the handheld.
Offline  
Old 08-18-2005, 06:48 AM   #6
piboe
New Member
 
Join Date: Aug 2005
Model: 7100
Posts: 7
Default

Why do you initialize your stringbuffer?
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1pcs used TSXMFPP128K Memory Card picture

1pcs used TSXMFPP128K Memory Card

$175.00



Coltene Hyflex CM Controlled Memory NiTi Files Rotary File System Set of 6 Files picture

Coltene Hyflex CM Controlled Memory NiTi Files Rotary File System Set of 6 Files

$47.49



Van Dorn Siemens Simatic Memory Sub Module Cat. No. 6ES5 374-0AA11 picture

Van Dorn Siemens Simatic Memory Sub Module Cat. No. 6ES5 374-0AA11

$200.00



ABB Memory Expansion Board DSQC 318 3HAB2221-1 picture

ABB Memory Expansion Board DSQC 318 3HAB2221-1

$174.95



Schneider Electric TSXMFPP384K Memory Card New picture

Schneider Electric TSXMFPP384K Memory Card New

$422.00



Schneider Electric TSXMRP032P Memory Card New Sealed picture

Schneider Electric TSXMRP032P Memory Card New Sealed

$400.63







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.