Rajesh Kondaveeti
asked on
bad application for tomcat 7.x
can any one provide an sample application for tomcat 7.x that can trigger OutOfMemory and hung threads?.
ASKER
@ Ajay, thanks for the inputs. i dont know to write the code or create the complete project. so i am here.
okay. Firstly you need to learn how to program for tomcat.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
1. Change your JVM heap memory configuration, which is usually higher. Set -Xms and -Xms 2M only like below.
-Xms2M -Xmx2M
2. put this code in your servlet
String a=null;
List<String>abc=new ArrayList<>();
long i=0;
long k=0;
for (i=0;i<674783848;i++){
for (k=0;k<674783848;k++){
a=new String(Long.toString(k));
abc.add(a);
}
}
Restart your server and run.