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


Dual Range Transistor Diode Semiconductor & Passive Curve Tracer Tester/Tracker picture

Dual Range Transistor Diode Semiconductor & Passive Curve Tracer Tester/Tracker

$26.99



7 pieces Semiconductor Device p/n 1643253-1  JANTX2N6352  New picture

7 pieces Semiconductor Device p/n 1643253-1 JANTX2N6352 New

$204.32



Peltier Cooler Thermoelectric DIY Semiconductor Refrigeration Cooling Fan Module picture

Peltier Cooler Thermoelectric DIY Semiconductor Refrigeration Cooling Fan Module

$19.00



2N5886 Original Pull Semiconductor picture

2N5886 Original Pull Semiconductor

$10.95



117AJG Original ON Semiconductor picture

117AJG Original ON Semiconductor

$10.95



NEW MITSUBISHI CM300DY-12 POWER TRANSISTOR MODULE INSULATED SEMICONDUCTOR picture

NEW MITSUBISHI CM300DY-12 POWER TRANSISTOR MODULE INSULATED SEMICONDUCTOR

$181.49







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