RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Allistair Crossley
You'll almost likely find that the reload via Ant does not free up all 
resources and so each time you perform a reload you'll be leaking some memory 
resulting in OOME after a week. 

3 things to do;

Get a profiler to see where you may be losing memory.
Ensure no resource/references are held onto, dispose references correctly
Hard restart Tomcat when OOME occur.

Allistair.

 -Original Message-
 From: NoKideen [mailto:[EMAIL PROTECTED]
 Sent: 20 September 2005 14:55
 To: tomcat-user@jakarta.apache.org
 Subject: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
 
 
 Hi all, I'm new in this mailling list
 
 I'm currently end up  ways to solve problem out of memory in tomcat
 
 this is
 startup script in my Linux Fedora Core 2
 
 CATALINA_OPTS= -Djava.awt.headless=true -server -Xss128k 
 -Xincgc -Xms256m 
 -Xmx256m
 
 CPU is on 1Giga Memory
 
 and the problem out of memory, can't happen in specific 
 times, can't happen in 
 specific pages (both servlet and JSP), currently happen in 
 Random time/pages, 
 usually 1 Weeks after startup.
 
 Server run 24 Hours/day for development only
 
 
 usually I use ant for reload servlet, after I change the java code
 
 #ant reload
 
 build.xml
 
 - cut -
 taskdef name=reload
 classname=org.apache.catalina.ant.ReloadTask/
 
 
 what should I do ?
 
 Thanks in Advance,
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
Disclaimer:  The information contained within this e-mail is confidential and 
may be privileged. This email is intended solely for the named recipient only; 
if you are not authorised you must not disclose, copy, distribute, or retain 
this message or any part of it. If you have received this message in error 
please contact the sender at once so that we may take the appropriate action 
and avoid troubling you further.  Any views expressed in this message are those 
of the individual sender.  QAS Limited has the right lawfully to record, 
monitor and inspect messages between its employees and any third party.  Your 
messages shall be subject to such lawful supervision as QAS Limited deems to be 
necessary in order to protect its information, its interests and its 
reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS 
Limited cannot guarantee that attachments are virus free or compatible with 
your systems and does not accept any liability in respect of viruses or 
computer problems experienced.
/FONT


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Phillip Qin
I would recommend you upgrade to 5.5.9 if you use struts.

-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
Sent: September 20, 2005 9:56 AM
To: Tomcat Users List
Subject: RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

You'll almost likely find that the reload via Ant does not free up all
resources and so each time you perform a reload you'll be leaking some
memory resulting in OOME after a week. 

3 things to do;

Get a profiler to see where you may be losing memory.
Ensure no resource/references are held onto, dispose references correctly
Hard restart Tomcat when OOME occur.

Allistair.

 -Original Message-
 From: NoKideen [mailto:[EMAIL PROTECTED]
 Sent: 20 September 2005 14:55
 To: tomcat-user@jakarta.apache.org
 Subject: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
 
 
 Hi all, I'm new in this mailling list
 
 I'm currently end up  ways to solve problem out of memory in tomcat
 
 this is
 startup script in my Linux Fedora Core 2
 
 CATALINA_OPTS= -Djava.awt.headless=true -server -Xss128k 
 -Xincgc -Xms256m 
 -Xmx256m
 
 CPU is on 1Giga Memory
 
 and the problem out of memory, can't happen in specific 
 times, can't happen in 
 specific pages (both servlet and JSP), currently happen in 
 Random time/pages, 
 usually 1 Weeks after startup.
 
 Server run 24 Hours/day for development only
 
 
 usually I use ant for reload servlet, after I change the java code
 
 #ant reload
 
 build.xml
 
 - cut -
 taskdef name=reload
 classname=org.apache.catalina.ant.ReloadTask/
 
 
 what should I do ?
 
 Thanks in Advance,
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
Disclaimer:  The information contained within this e-mail is confidential
and may be privileged. This email is intended solely for the named recipient
only; if you are not authorised you must not disclose, copy, distribute, or
retain this message or any part of it. If you have received this message in
error please contact the sender at once so that we may take the appropriate
action and avoid troubling you further.  Any views expressed in this message
are those of the individual sender.  QAS Limited has the right lawfully to
record, monitor and inspect messages between its employees and any third
party.  Your messages shall be subject to such lawful supervision as QAS
Limited deems to be necessary in order to protect its information, its
interests and its reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS
Limited cannot guarantee that attachments are virus free or compatible with
your systems and does not accept any liability in respect of viruses or
computer problems experienced.
/FONT


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


!DSPAM:43301517266771032322572!


RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Caldarale, Charles R
 From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
 Subject: RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
 
 3 things to do;
 
 Get a profiler to see where you may be losing memory.
 Ensure no resource/references are held onto, dispose 
 references correctly
 Hard restart Tomcat when OOME occur.

In addition to the above, you might want to increase your -Xmx setting
and the size of the permanent generation (-XX:PermSize=??).  This won't
eliminate the need to restart Tomcat, but it may allow you more time
between restarts.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread NoKideen
On Tuesday 20 September 2005 20:56, Allistair Crossley wrote:
 You'll almost likely find that the reload via Ant does not free up all
 resources and so each time you perform a reload you'll be leaking some
 memory resulting in OOME after a week.

 3 things to do;

 Get a profiler to see where you may be losing memory.

I will do this,

 Ensure no resource/references are held onto, dispose references correctly
how do I know Resource still in memory, usually in my servlet I always close 
my database connection, 

usually I use String to collect output first and out.print() those String
example :
String a=;
a+=Test 1;
a+=Test 2;
// very long , and almost 1 page 

out.println(a);

can this cause out of memory problem ?

I though there is Garbage Collector, as usually in Java Native Program ? 
if Garbage Collector is not working, how do I free up Resource in servlet ?


 Hard restart Tomcat when OOME occur.

if ant reload, cause the problem, 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Allistair Crossley
A listener that calls

LogManager.shutdown();
LogFactory.releaseAll();
Introspector.flushCaches();

on contextDestroyed 

might also help if you are using certain apis like log4j, struts.

Allistair.

 -Original Message-
 From: Caldarale, Charles R [mailto:[EMAIL PROTECTED]
 Sent: 20 September 2005 15:08
 To: Tomcat Users List
 Subject: RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
 
 
  From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
  Subject: RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
  
  3 things to do;
  
  Get a profiler to see where you may be losing memory.
  Ensure no resource/references are held onto, dispose 
  references correctly
  Hard restart Tomcat when OOME occur.
 
 In addition to the above, you might want to increase your -Xmx setting
 and the size of the permanent generation (-XX:PermSize=??).  
 This won't
 eliminate the need to restart Tomcat, but it may allow you more time
 between restarts.
 
  - Chuck
 
 
 THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE 
 PROPRIETARY
 MATERIAL and is thus for use only by the intended recipient. If you
 received this in error, please contact the sender and delete 
 the e-mail
 and its attachments from all computers.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
Disclaimer:  The information contained within this e-mail is confidential and 
may be privileged. This email is intended solely for the named recipient only; 
if you are not authorised you must not disclose, copy, distribute, or retain 
this message or any part of it. If you have received this message in error 
please contact the sender at once so that we may take the appropriate action 
and avoid troubling you further.  Any views expressed in this message are those 
of the individual sender.  QAS Limited has the right lawfully to record, 
monitor and inspect messages between its employees and any third party.  Your 
messages shall be subject to such lawful supervision as QAS Limited deems to be 
necessary in order to protect its information, its interests and its 
reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS 
Limited cannot guarantee that attachments are virus free or compatible with 
your systems and does not accept any liability in respect of viruses or 
computer problems experienced.
/FONT


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Peter Crowther
 From: NoKideen [mailto:[EMAIL PROTECTED] 
 usually I use String to collect output first and out.print() 
 those String
 example :
 String a=;
 a+=Test 1;
 a+=Test 2;
 // very long , and almost 1 page 
 
 out.println(a);
 
 can this cause out of memory problem ?

It won't help much - you'll build up String objects very quickly.  See
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html for
a better approach that won't leave so many string fragments lying
around, roughly:

StringBuffer a = new StringBuffer();
a.append(Test 1);
a.append(Test 2);
...
out.println(a.toString());

However, this will merely cause the GC to run more frequently; it won't
run you out of memory.  Something else is causing that.

- Peter

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Mark
2 notes.  

When using Java 1.5, StringBuilder class is supposed to be better
according to documentation.  Also, what has worked for me, is that if
any of the strings can be generated ahead of time, do so in a static
block and convert the strings to byte[].  This not only eliminates
redundant Strings from being built, but also speeds up the I/O.



On 9/20/05, Peter Crowther [EMAIL PROTECTED] wrote:
  From: NoKideen [mailto:[EMAIL PROTECTED]
  usually I use String to collect output first and out.print()
  those String
  example :
  String a=;
  a+=Test 1;
  a+=Test 2;
  // very long , and almost 1 page
 
  out.println(a);
 
  can this cause out of memory problem ?
 
 It won't help much - you'll build up String objects very quickly.  See
 http://java.sun.com/j2se/1.4.2/docs/api/java/lang/StringBuffer.html for
 a better approach that won't leave so many string fragments lying
 around, roughly:
 
 StringBuffer a = new StringBuffer();
 a.append(Test 1);
 a.append(Test 2);
 ...
 out.println(a.toString());
 
 However, this will merely cause the GC to run more frequently; it won't
 run you out of memory.  Something else is causing that.
 
 - Peter
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Sonja Löhr

I know this problem very well, since I worked on a very memory-consuming
app where I coulnd't even reload twice. It has nothing to do with ant,
and i think I also had such a case with tomcat 5.5  (now working on
normal webapps ;-)
Cautiously, I would never reload via manager (or perhaps once) in
production.

sonja

Am Dienstag, den 20.09.2005, 14:56 +0100 schrieb Allistair Crossley:
 You'll almost likely find that the reload via Ant does not free up all 
 resources and so each time you perform a reload you'll be leaking some memory 
 resulting in OOME after a week. 
 
 3 things to do;
 
 Get a profiler to see where you may be losing memory.
 Ensure no resource/references are held onto, dispose references correctly
 Hard restart Tomcat when OOME occur.
 
 Allistair.
 
  -Original Message-
  From: NoKideen [mailto:[EMAIL PROTECTED]
  Sent: 20 September 2005 14:55
  To: tomcat-user@jakarta.apache.org
  Subject: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04
  
  
  Hi all, I'm new in this mailling list
  
  I'm currently end up  ways to solve problem out of memory in tomcat
  
  this is
  startup script in my Linux Fedora Core 2
  
  CATALINA_OPTS= -Djava.awt.headless=true -server -Xss128k 
  -Xincgc -Xms256m 
  -Xmx256m
  
  CPU is on 1Giga Memory
  
  and the problem out of memory, can't happen in specific 
  times, can't happen in 
  specific pages (both servlet and JSP), currently happen in 
  Random time/pages, 
  usually 1 Weeks after startup.
  
  Server run 24 Hours/day for development only
  
  
  usually I use ant for reload servlet, after I change the java code
  
  #ant reload
  
  build.xml
  
  - cut -
  taskdef name=reload
  classname=org.apache.catalina.ant.ReloadTask/
  
  
  what should I do ?
  
  Thanks in Advance,
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
 FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
 ---
 QAS Ltd.
 Registered in England: No 2582055
 Registered in Australia: No 082 851 474
 ---
 /FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
 Disclaimer:  The information contained within this e-mail is confidential and 
 may be privileged. This email is intended solely for the named recipient 
 only; if you are not authorised you must not disclose, copy, distribute, or 
 retain this message or any part of it. If you have received this message in 
 error please contact the sender at once so that we may take the appropriate 
 action and avoid troubling you further.  Any views expressed in this message 
 are those of the individual sender.  QAS Limited has the right lawfully to 
 record, monitor and inspect messages between its employees and any third 
 party.  Your messages shall be subject to such lawful supervision as QAS 
 Limited deems to be necessary in order to protect its information, its 
 interests and its reputation.  
 
 Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS 
 Limited cannot guarantee that attachments are virus free or compatible with 
 your systems and does not accept any liability in respect of viruses or 
 computer problems experienced.
 /FONT
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Sonja Löhr [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread NoKideen

On Tuesday 20 September 2005 21:11, Sonja Löhr wrote:
 I know this problem very well, since I worked on a very memory-consuming
 app where I coulnd't even reload twice. It has nothing to do with ant,
 and i think I also had such a case with tomcat 5.5  (now working on
 normal webapps ;-)

what you mean by normal webapps ? it's a html ?

 Cautiously, I would never reload via manager (or perhaps once) in
 production.

I'd really confuse, what is the real cause ?
Its the development (frequently use ant/ web manager ) to reload the 
webapps  ?

or 

Garbage collector problem ? every pages of servlet loaded, its use many 
library, Class file, example my own class :

public test servlet extends HttpServlet
.. doGet(...) {
...
PgInt pg = new PgInt();


pg.close();
pg = null;

}

It that means pg Objects is Destroyed,

or I must do something else ?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Out of Memory on Jakarta Tomcat 5.0.19, jdk1.5.0_04

2005-09-20 Thread Sonja Löhr


Unfortunately, I can't give you an answer -
it my well be that my code IS somehow suboptimal, but if the application
runs, all is well, it is just that reload (I'm not sure about start and
stop now) over the manager app.
To be honest, I always waited for the next tomcat release to magically
make it work, but that wasn't the case ;-(

normal webapp? I mean I have rarely such a problem with my struts
busines apps, the memory-critical unnormal webapp was kind of AI
program needing really a lot of rules and stuff. 


Am Dienstag, den 20.09.2005, 22:17 +0700 schrieb NoKideen:
 On Tuesday 20 September 2005 21:11, Sonja Löhr wrote:
  I know this problem very well, since I worked on a very memory-consuming
  app where I coulnd't even reload twice. It has nothing to do with ant,
  and i think I also had such a case with tomcat 5.5  (now working on
  normal webapps ;-)
 
 what you mean by normal webapps ? it's a html ?
 
  Cautiously, I would never reload via manager (or perhaps once) in
  production.
 
 I'd really confuse, what is the real cause ?
 Its the development (frequently use ant/ web manager ) to reload the 
 webapps  ?
 
 or 
 
 Garbage collector problem ? every pages of servlet loaded, its use many 
 library, Class file, example my own class :
 
 public test servlet extends HttpServlet
 .. doGet(...) {
 ...
   PgInt pg = new PgInt();
 
 
   pg.close();
   pg = null;
 
 }
 
 It that means pg Objects is Destroyed,
 
 or I must do something else ?
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Sonja Löhr [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]