356 CHAPTER 14 SOLVING COMMON JAVA EE (Web hosting reviews)

356 CHAPTER 14 SOLVING COMMON JAVA EE PERFORMANCE PROBLEMS Figure 14-4. When the tenured space becomes full, the garbage collector suspends all execution threads and performs a full mark and sweep garbage collection. It frees all dead objects and moves all live objects to a newly compacted tenured space, leaving Eden and both survivor spaces empty. From Sun s implementation of garbage collection, you can see that objects in the old generation can be collected only by a major collection. Long-lived objects are expensive to clean up, so you want to ensure that short-lived objects die in a timely manner before they have a chance to be tenured, and hence require a major garbage collection to reclaim their memory. All of this background prepares us to identify memory leaks. Memory is leaked in Java when an object maintains an unwanted reference to another object, hence stopping the garbage collector from reclaiming its memory. In light of the architecture of the Sun JVM, objects that are not dereferenced will make their way through Eden and the survivor spaces, into the old generation. Furthermore, in a multiuser Web-based environment, if multiple requests are being made to leaky code, we will see a pattern of growth in the old generation. Figure 14-5 highlights potential candidates for leaked objects: objects that survive multiple major collections in the tenured space. Not all objects in the tenured space represent memory leaks, but all leaked objects will eventually end up in the tenured space. If a true memory leak exists, the tenured space will begin filling up with leaked objects until it runs out of memory. Therefore, we want to track the effectiveness of garbage collection in the old generation: each time that a major garbage collection runs, how much memory is it able to reclaim? Is the memory use in the old generation growing according to any discernable pattern?
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply