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


Cole Hersee (24059-BP) 12V Insulated SPST Continuous Duty Solenoid picture

Cole Hersee (24059-BP) 12V Insulated SPST Continuous Duty Solenoid

$35.36



3/4

3/4" NPT Electric Solenoid Valve 12VDC 12-Volt DC Viton Stainless Steel SS

$53.80



S.36121 Starter Solenoid Fits John Deere picture

S.36121 Starter Solenoid Fits John Deere

$38.54



SA-3786-12 603350 Fuel Shutoff Solenoid Kubota Compatible 721D2 21HP Grasshopper picture

SA-3786-12 603350 Fuel Shutoff Solenoid Kubota Compatible 721D2 21HP Grasshopper

$29.29



US Stock DC 24V Pneumatic Electric Solenoid Air Valve 5 Way 2 Position 4V210-08 picture

US Stock DC 24V Pneumatic Electric Solenoid Air Valve 5 Way 2 Position 4V210-08

$17.46



1/2

1/2" 110V 120V AC Brass Electric Solenoid Valve Water Air Gas Viton NC 110VAC

$35.95







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