Renz,

It is possible that your JVM will finally garbage collect the unused
HTMLProducer objects.  Many garbage collectors don't gc till heapsize
exceeds half of the available heapsize.  So you may try to keep running it
for a while and see if it is being garbage collected, or does the JVM crash
because of that.

--amrinder


-----Original Message-----
From: Renz Daluz [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 10, 2001 8:30 PM
To: [EMAIL PROTECTED]
Subject: static method vs. none static method


Hi,

I'm doing a testing on my  servlet codes and I'm using OptimizeIt for
testing. Now my servlet is calling none servlet class. And from the test I
found this big difference between calling a static method and none static
method.

static method:

   from my servlet I have this in my java code:

        HTMLProducer.getHtml(param1, param2);

When viewing this in OptimizeIt, HTMLProducer does not create another
instance and just right after finishing the request, HTMLProducer instance
is
now equal to 0 (zero) or no more instance of this class already exist.


none static metho:

    from my servlet I have this in my java code:

          HTMLProducer hp = new HTMLProducer();
          hp.getHtml(param1, param2);

When viewing this in Optimizeit, every time I call the servlet, a new
instance of HTMLProducer is created. Thus, this instance will never be 0
(zero) or none. So it will continue to increase, and I seems that the
garbage
collector doesn't collect this instances.

Can anybody explain to me what is difference between calling a class with
static method and none static methos? What is the advantage and disadvantage
between those two?

Thank you.

Best regards
/renz

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to