text: I was reading servlet advantages as below(http://www.javatpoint.com/servlet-tutorial)
  3. Robust: Servlets are managed by JVM so no need to worry about momory leak, garbage collection etc.
  4. Secure: because it uses java language..
  I have not understood point number1,3. Can you please explain.
  https://www.experts-exchange.com/questions/28397918/servlet-advantages.html copy
  The comments on that page are based on comparing using a Java servlet to using a really old technology - cgi scripts.
  Those worked by running a small executable program on the server to process a request from a user.
  #1 follows because to servlet is a thread that executes inside an already running process (the Java web application, like Tomcat), rather than having to start a completely new process (the executable cgi program) from scratch.
  #3 follows because a servlet is part of a Java program, so it runs (like all Java programs) inside the JVM which means it comes with garbage collection and the other benefits of being a program in a managed environment, rather than a C++ executable (like a CGI script).
  Gibu GeorgeChief Technology OfficerCommented: 2014-03-27
  JVM takes care of clearing the unreferenced objects from the memory, which is called automatic garbage collection. Some details are available here :
  How running cgi script is different from servlet. pelase advise
  Gibu GeorgeChief Technology OfficerCommented: 2014-04-02
  IServlets are run in one process (HTTP server with additional features, which called Servlet Container) and they exist as long as that process exists.
  CGI means every time there's client request, HTTP server creates new instance of process to serve this request. This is performance killer. Additionally, since there's new process per each request, it means CGI can't aggregate data from several requests in memory, as Servlets can, and must resort to external persistent storage (file or DB). This is performance killer as well.
  it means CGI can't aggregate data from several requests in memory, as Servlets can,
  How servlets do this task currently? please advise
  When a servlet runs it's just a part of a long running Java process - the web server. E.g. Tomcat.
  Tomcat doesn't start and stop with each request. It's always in memory and can store information from a series of requests.
  A cgi process on the other hand starts from scratch each tine in response to a request and exits completely when the request finishes. So there's no long running process in memory that you can use to store long term data.