--- Ingrid Morterud <[EMAIL PROTECTED]> wrote: > > > Thanks for the quick reply. > > You might be right in us not understanding the java > heap. Still - then > we are even more at a loss on how to fix the problem > than if we really > had understood how it works. > > We are running on a test server with 64 mb total > memory. I know I can > increase that, still increasing it will not solve > the original problem. > To be quite honest I am not quite sure what I would > be expecting to be > using, but I would think that the application up and > running would use > less than what it is using at the moment. > > We are using the following code to determine the > memory used: > > <br> > <%=java.lang.Runtime.getRuntime().freeMemory()/1024%> > KB > <br> > <%=java.lang.Runtime.getRuntime().maxMemory()/1024%> > KB > <br> > <%=java.lang.Runtime.getRuntime().totalMemory()/1024%> > KB > <br> > > The application uses approx 40 - 45 Mb when it is > running. During > runtime (when users access and use the application) > they use from zero > to 25 Mb of memory. I still cannot find any pattern > as to when it uses > the memory. The amount of memory used changes not > accordingly to the > user input, that means that when a user does the > same thing twice, that > does not mean that the same amount of memory is > used. > > We haven't used a memory profiler as of yet, but we > are going to try > that out now. > > If you have any more hints and tips, it would be > highly appreciated. > > > Ingrid and Tommy >
Ingrid, I included this on the tomcat users list. Yes, any time you reply to a mail where you asked the question on the list then please include the entire list. It will help everyone help you out as they will get the information you give me, and if it is something they could better help you with then the right person got the info, and you can get helped faster. Yeah, 64mb of memory could be enough depending on what you are doing, but you are using struts and I don't know what other libraries. The jvm itself will use a number of megs of memory simply by loading classes and static information into what is know as Persistent memory. A good link would be: http://java.sun.com/docs/performance/ where you will find a lot of information about memory and performance. Also see: http://java.sun.com/docs/hotspot/gc1.4.2/ Also understand that the info you will see with the commands you are using in your source code are not going to show you the memory being used by the persistent section of the JVM process nor are they going to show you the OS reserved memory for the process or "virtual memory". So, you might have issues trying to use Tomcat on a 64MB machine depending on the number of libraries used to the number of classes loaded to the number of static variables and things of that nature. The OS will use a number of memory along with what ever other applications you are using. After that memory is used you start paging to disk a lot and performance will stink at best. You can also search the list for JProfiler. There have been other mailings about memory and leaks on the list and a lot of information for a starting point has already been provided. I can simply start tomcat with only the admin and manager application running and be using 22mb of memory. Are you memory usage reports after your web application has loaded. Then after it has loaded you are using 40+mb? You can find jstat and install it into your 1.4.2 jvm. If you have 1.5 it will already be available. Then with tomcat running do a jps to locate your PID and then jstat -class PID to explain the classes loaded before you hit your first URL to your web app vs after. Might tell you something as well. Using: http://java.sun.com/docs/hotspot/gc1.4.2/ and JAVA_OPTS you should be able to adjust the memory usage of tomcat, and if not you might have to dig into catalina.bat or if on windows use the configure tomcat GUI for the service. But, that amount of memory is so tiny I don't think you'll have much luck if your web application expects much usage. It will all depend on the number of classes being loaded and used and the number of objects being instantiated. You can limit your entire heap with the -mx option of the JVM. This will not however limit your persistent memory usage. You'll have to use -XX:MaxPermSize to limit that. Limiting your heap and your permsize however will mean you know for a fact or good close estimate that you should be loading x number of classes and using x number of perm memory and limiting your heap means you have calculated your application and tomcats expected memory usage and number of supported users for your needs. Wade --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]