Howdy,

>I usually track the memory consumption of each request using a debug
info
>which prints the free memory available.
>
>Runtime r = Runtime.getRuntime();
>long freeMem = r.freeMemory();
>System.out.println("free memory: " + freeMem);

So this tells you the free memory when the request came in.  You can do
it when the request goes out as well, but unless this was the only
request during that time and nothing else is happening, the information
is meaningless.  And in a servlet container, it's almost never true that
nothing else is happening.

>I think packaging this into a memory tracking module for all requests
>served could be quite informative for a developer.

How???  You would have to prove the validity of this memory tracking
approach before people accept it as a valid tool.

>Personally I think it's a fundamental weakness of Java that you don't
have
>a String.getMemoryConsumption() method or something like that. That
would
>make it much easier to track memory consumption.

It would make it much easier indeed, but I still don't think that
functionality belongs in the core language.  This is what the JVMPI is
for.

>However, the garbage collector seems to run at quite undetermined
>intervals, because after ten requests in a row the free memory goes up
>again. Does anybody know how to configure the garbage collector for
>Tomcat?

Tomcat doesn't have its own garbage collector, the JVM does.  And it's
quite configurable.  See http://java.sun.com/docs/hotspot/VMOptions.html
for the available tuning parameters, nearly all of which can greatly
affect garbage collection.

Yoav Shapira
Millennium ChemInformatics



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to