twain007 wrote:
I gave the was 1GB ,The Application should wast so many memory,it should be half of them at most!
When i executed the application ,the memory just speed up ,without any idea to drop down!
Read more about IBM JDK's memory management and garbage collector. It's a long story but the hansel and gretel version of it is that it doesn't matter how much memory your application needs, JDK keeps allocating memory since it is easier to allocate memory as compared to fragmenting memory and freeing some space in that way. What you need to do is to turn on VerboseGC on your application and look at memory consumption with a tool like Tivoli and see how much memory your application actually needs. Then you will need to set your JVM maximum heap size to that. In addition, you might want to instruct JVM to keep a maximum free memory which means whenever it frees some memory it also shrinks its allocated memory to ensure a certain maximum percentage and not more than that. In any events, it is true hibernate creates lots of objects, and believe it or not jdbc drivers are even worst than hibernate, but I am not aware of any memory leak from Hibernate code. Ah, in addition do not set your minimum heap memory to anything high. That's a common mistake.
Farzad-