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


4 Count Case GE ProLine 2 Bulb 120V T12 Electronic Fluorescent Light Ballasts picture

4 Count Case GE ProLine 2 Bulb 120V T12 Electronic Fluorescent Light Ballasts

$49.99



Accupro 703-00004-001  1 or 2 lamp T12 Rapid-Start Electronic Ballast  picture

Accupro 703-00004-001 1 or 2 lamp T12 Rapid-Start Electronic Ballast

$8.50



Ballast Box 3 Point Category 1 Tractor Loader 2

Ballast Box 3 Point Category 1 Tractor Loader 2" Hitches Quick Tach Attachment

$199.99



Philips ADVANCE AmbiStar RELB-2S40-N Replacement Ballast 40-Watt 2-Lamp T12 picture

Philips ADVANCE AmbiStar RELB-2S40-N Replacement Ballast 40-Watt 2-Lamp T12

$18.79



Ballast Box 3 Pt Hitch 800LBS Counterweight for Cat 1 Tractor Steel Heavy Duty picture

Ballast Box 3 Pt Hitch 800LBS Counterweight for Cat 1 Tractor Steel Heavy Duty

$189.99



PHILIPS ADVANCE Core-Coil Ballast Kit 71A5389- 1-100W M90 Metal Halide.FreeShip picture

PHILIPS ADVANCE Core-Coil Ballast Kit 71A5389- 1-100W M90 Metal Halide.FreeShip

$22.99







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