AW: StringBuffer memory optimization
Hi > There is a known StringBuffer memory leak in a certain version of the jvm (which I can't remember now offhand). But I'm pretty sure I mentioned on this list before, so search the archives. (or just wait.. someone will chime in with the exact version). I think it was around 4.1.2_05 ? First, you propably mean 1.4.2_05. Second, no, that's the current 1.4.x one without that error. I thing 1.4.2_02 hat that. However 1.5.0 is fine and stable. Upgrade. Regards, Steffen smime.p7s Description: S/MIME cryptographic signature
RE: StringBuffer memory optimization
There is a known StringBuffer memory leak in a certain version of the jvm (which I can't remember now offhand). But I'm pretty sure I mentioned on this list before, so search the archives. (or just wait.. someone will chime in with the exact version). I think it was around 4.1.2_05 ? > -Original Message- > From: Edson Alves Pereira [mailto:[EMAIL PROTECTED] > Sent: Friday, October 08, 2004 3:28 PM > To: Tomcat-User List (E-mail) > Subject: StringBuffer memory optimization > > > Hello folks, i have a problem with StringBuffer, > profiling my web-application i noticed, StringBuffer due to > its creation and use consumes too much memory. Does onyone > here know a good way to solve that problem? > > Regards, > Edson > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StringBuffer memory optimization
> Hello folks, i have a problem with StringBuffer, profiling my > web-application i noticed, StringBuffer due to its creation and use consumes > too much memory. Does onyone here know a good way to solve that problem? Not much to go on there, but a key factor to using StringBuffer "well" is if you can estimate how big the resulting String will be beforehand. This is because StringBuffer starts out rather small (16 characters as I recall) and grows as needed. Each time it grows, it has to allocate a new buffer and copy the previous buffer, so it can be wasteful if misused this way. So, if you know before, do something like: StringBuffer buf = new StringBuffer(4000); Or, if you already have a buffer and you need to add another 500 characters, you can use: buf.ensureCapacity(buf.length()+500); The second will ensure that the buffer is at least big enough to hold its current contents plus another 500 characters so that if it's not big enough, it will only do one reallocation as you add up to another 500 characters. Good luck, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StringBuffer memory optimization
On Fri, Oct 08, 2004 at 05:27:52PM -0300, Edson Alves Pereira wrote: : Hello folks, i have a problem with StringBuffer, profiling my : web-application i noticed, StringBuffer due to its creation and use consumes : too much memory. Does onyone here know a good way to solve that problem? That's fairly vague, so all I can say is: 1/ figure out where you're using StringBuffer, and use something else 2/ otherwise, increase the heap space =) -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
StringBuffer memory optimization
Hello folks, i have a problem with StringBuffer, profiling my web-application i noticed, StringBuffer due to its creation and use consumes too much memory. Does onyone here know a good way to solve that problem? Regards, Edson