>- see footer for list info -<
Yup, ended up using Peter's method of splitting up different branches in the
XML into separate files, which meant I didn't have to concatenate the string
variables. Still creating large variables though, so had to increase the
MaxPermSize

Now running with

<jvm-arg>-Xmx1000M</jvm-arg>
<jvm-arg>-Xms1000M</jvm-arg>
<jvm-arg>-Xmn512M</jvm-arg>

in the resin.conf file

Which is able to handle it. Its a lot of memory to dedicate, but the machine
isn't doing anything else. If anyone else has any memory tips for Railo, I'm
all ears though.

in other news, I love Railo. Its pretty cool.

2009/12/7 Snake <[email protected]>

> >- see footer for list info -<
> Rich,
>
> Simons method will have resulted in a lot of class loading being that
> object
> had to be instantiated each time, which if you are doing it many times for
> each request then this would explain the out of memory issue.
>
> Try using
>
> Application.oXml = createObject("java","java.lang.StringBuilder").init();
>
> So you are caching the object.
>
> Also class loading uses different java memory than general page execution.
> To increase the memory available for this you need to up the MaxPermSize
>
> Glad to see you are using Railo ;-)
>
> --
> Russ
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Rich Wild
> Sent: 06 December 2009 23:08
> To: [email protected]; Coldfusion Development
> Subject: Re: [CF-Dev] Railo, Resin and large text variables = out of memory
>
> >- see footer for list info -<
> Hi Simon,
>
> I'm sure the theory is correct, but when I altered my script t use your
> StringBuilder, it ran out of memory much quicker than ever before. Going
> back to my original version e.g.
>
> xmlText = ''
> ..loop over query, building sub-xmlString..
> xmlText &= subString
>
> resulted in a more efficient profile and no crash (prob thanks to my
> high-memory limit profile in the resin.cong file)
>
> But I'm interested to know why the stringbuilder approach resulted in an
> out-of-memory crash much quicker than before....?
>
> Rich
>
> 2009/12/6 Simon Baynes <[email protected]>
>
> > >- see footer for list info -<
> >
> > To be honest this something you should just get SQL server to do without
> > CFML. However, if you are definitely going down this path then there are
> a
> > few things you should know. In Java Strings are immutable this means that
> > you cannot change a string once it has been assigned. So if you do things
> > like:-
> >
> > <cfscript>
> > myString = "Simon";
> > myString = myString & " Baynes";
> > writeoutput(myString);
> > </cfscript>
> >
> > This doesn't actually update the variable but create a new variable in
> > memory that is the result of the second assignment. The old value will
> sit
> > in memory waiting to be Garbage Collected. I am sure you can now see that
> if
> > you are looping through a query doing loads of append statements then
> it's
> > going to create lots of information in memory.
> >
> > There is a Java class for this very type of operation called a
> > StringBuilder that manages this internally to reduce the memory usage.
> >
> > <cfscript>
> > oXml = createObject("java","java.lang.StringBuilder").init();
> > oXml.append("Simon");
> > oXml.append(" Baynes");
> > writeoutput(oXml.toString());
> > </cfscript>
> >
> > When using this for multiple append statements it'll save you lots of
> > memory!
> >
> > Having said that creating a 50Meg xml file will use at the very least
> 50Meg
> > of memory for that request which is not really what App Servers like
> Railo
> > or CF are for hence the advice of doing the whole job in SQL server.
> >
> > Hope that helps!
> >
> > Simon
> > Simon Baynes
> > www.simonbaynes.com
> > Free online storage you can access anywhere:-
> > http://www.simonbaynes.com/getsugarsync
> > LinkedIn profile:- http://www.linkedin.com/in/simonbaynes
> >
> > -----Original Message-----
> > From: Rich Wild <[email protected]>
> > Date: Sun, 6 Dec 2009 19:55:30
> > To: Coldfusion Development<[email protected]>
> > Subject: [CF-Dev] Railo, Resin and large text variables = out of memory
> >
> > >- see footer for list info -<
> > Wotcha,
> >
> > I'm using Railo 3.1.2 + Resin 3.1 on an II6 Server. Its all been brill on
> > toast, thus far.
> >
> > Now, on this particular website, they have a requirement to build large
> XML
> > files produced from SQL Server databases. These XML files can be over
> 50Mb
> > in size.
> >
> > I'm running my SQL statements and building the XML using cfsavecontent
> > before saving out using cffile and zipping with cfzip. I figured
> producing
> > them as appended string variables as opposed to XML variables would save
> > time, processing and memory.
> >
> > However, I inconsistently get errors whilst building these files:
> >
> > Railo 3.1.2.001 Error (Java.lang.outofmemoryerror) - Java heap space
> >
> > Hmmm. That's not good.
> >
> > I tracked down the resin.conf  file and changed
> >
> > <jvm-arg>-Xmx256m</jvm-arg>
> > to
> > <jvm-arg>-Xmx512m</jvm-arg>
> >
> > to try and increase the memory available. I still get the errors.
> >
> > Anyone have any clues how I can make this go away? I'm sure a comparable
> > CF8/9 server on the same hardware config machine wouldn't have this
> > problem.
> > They're not THAT big XML files.
> >
> > Cheers,
> > Rich
> > _______________________________________________
> >
> > For details on ALL mailing lists and for joining or leaving lists, go to
> > http://list.cfdeveloper.co.uk/mailman/listinfo
> >
> > --
> > CFDeveloper Sponsors:-
> > >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> > >- Lists hosted by www.Gradwell.com -<
> > >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> -<
> >
> > _______________________________________________
> >
> > For details on ALL mailing lists and for joining or leaving lists, go to
> > http://list.cfdeveloper.co.uk/mailman/listinfo
> >
> > --
> > CFDeveloper Sponsors:-
> > >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> > >- Lists hosted by www.Gradwell.com -<
> > >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> -<
> >
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
>
>
>
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
>
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- cfdeveloper Hosting provided by www.cfmxhosting.co.uk -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to