You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Garner, Shawn" <sh...@pearson.com> on 2005/12/02 22:51:16 UTC

RE: OT: OutOfMemory

I would think he should use some kind of a buffered input stream and only
read in part of the data at once.

That way he would never have the entire string in the buffer at once.

Then open an output stream at the same time and write out the modified
contents to it.

This way I wouldn't think the buffer would have to be any more than three
times the length of the longest string you're searching for.

If you were searching for b*e*a*r your buffer would only need to be 3 times
the length of bear plus the max length of a * (there has to be some limit if
you look at actual data).

Shawn
-----Original Message-----
From: Chen Jerry [mailto:tech.jerry.chen@gmail.com] 
Sent: Tuesday, November 29, 2005 12:12 AM
To: Struts Users Mailing List
Subject: Re: OT: OutOfMemory

Rechard,

I suppose Eric wanna output HTML.

I myself prefer css to font tags. Introducing an XSLT engine is a nice
idea, however, it seems not the choice of Eric.

I suppose the current problem results from default configuration of
JVM or large numbers of substring with a big string.

Regards,

Jerry

2005/11/29, Richard Yee <ry...@cruzio.com>:
> Jerry,
> Are you trying to output HTML? If so, you should consider:
> 1) using CSS instead of the font tags
> 2) use an XSLT transform or transform the text as you output it rather
> than doing it in memory.
>
> -Richard
>
>
> Jason Lea wrote:
> > What is textFormat?
> > It isn't a StringBuilder is it?
> >
> > textFormat.append(subText);
> >
> >
> > Eric Plante wrote:
> >> for (Integer posLetter: positions){
> >>     String subText = fullText.substring(start, posLetter);
> >>     textFormat.append(subText);
> >>     subText = null; //not required
> >>     start = posLetter + 1;
> >> }
> >>
> >> with fullText = 5M and textFormat that's even bigger it crashes.
> >>
> >> An friend tried with a 15M file using Lingo language and it worked
> >> without
> >> problems and I bet .NET would have no problem either but I'll know
> >> tomorrow.
> >> ----------------------------------------
> >> Sorry to hear that.
> >>
> >> Would you please show some source code relative to the problem?
> >>
> >> Well, 5000 loops of substring with a big string is terrible.
> >>
> >> 2005/11/29, Eric Plante <pl...@videotron.ca>:
> >>
> >>> It wasn't there but I added it and whatever I used -Xmx or -XX, it
> >>> didn't
> >>> work. I wrote 100m for the -XX...
> >>>
> >>> I also checked again where I could optimized and where I could find
> >>> memory
> >>> leakage. Reducing the number of string meant using StringBuilder's
> >>> insert....the slowness of that command makes it not an option. I
> >>> couldn't
> >>> find any memory leakage.
> >>>
> >>> Where the program systematicaly crash is a loop where I do a
> >>> substring of
> >>> the big string everytime(about 5000 loops).I then fill a StringBuilder
> >>>
> >> which
> >>
> >>> will eventualy be bigger than the main string. That's the fastest way
I
> >>>
> >> can
> >>
> >>> do what need to be done and it needs to be fast.
> >>>
> >>> I'm starting to loose faith in Java...I'll ask a friend that
> >>> isa.NETspecialist to see if.NET has that problem too...a problem Java
> >>> shouldn't have...
> >>>
> >>> -----------------------------------
> >>>
> >>> I found in my catalina.bat:
> >>> set JAVA_OPTS=
> >>> Instead of that, use:
> >>> set JAVA_OPTS=-XX:MaxPermSize=10m
> >>>
> >>> -Xmx512m seems only increase max size of heap rather than perm
> >>> division.
> >>>
> >>> 2005/11/29, Eric Plante <pl...@videotron.ca>:
> >>>
> >>>> I found the required catalina files and I see 4 lines with the
> >>>> JAVA_OPTS
> >>>> variable. I tried replacing JAVA_OPTS and then %JAVA_OPTS% by
-Xmx512m
> >>>>
> >> in
> >>
> >>>> the catalina.bat file but I still get the error message, what am I
> >>>>
> >> suppose
> >>
> >>>> to do in that file?
> >>>>
> >>>> ----- Original Message -----
> >>>> From: "netsql" <ne...@roomity.com>
> >>>> To: <us...@struts.apache.org>
> >>>> Sent: Sunday, November 27, 2005 10:09 PM
> >>>> Subject: Re: OT: OutOfMemory
> >>>>
> >>>>
> >>>>
> >>>>> http://tomcat.apache.org/faq/memory.html#adjust
> >>>>>
> >>>>>
> >>>>> Eric Plante wrote:
> >>>>>
> >>>>>> I'm on windows XP and the only catalina files that might serve for
> >>>>>> configuration are Catalina.properties and catalina.policy
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>
---------------------------------------------------------------------
> >>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>>
> >>>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>> For additional commands, e-mail: user-help@struts.apache.org
> >>>>
> >>>>
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>> For additional commands, e-mail: user-help@struts.apache.org
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>> For additional commands, e-mail: user-help@struts.apache.org
> >>>
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

**************************************************************************** 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 
****************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org