![Page 1: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/1.jpg)
Memory Leak
WEBLOGIC SERVER
![Page 2: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/2.jpg)
Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices to avoid/detect Memory Leak Q & A
AGENDA
![Page 3: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/3.jpg)
Overview of Java Heap
Java Heap can be categorized into three generations: - Young, Tenured and Permanent.
Young generation has Eden Space and two survivor spaces. All newly created objects are kept in Eden Space and moved to one of the survivor space after it survives few gc’s. From one survivor space it moves to another. At an instant one of the survivor space is completely free. From the survivor space, objects are moved to the tenured generations.
Permanent holds class data, such as describing classes and methods.
![Page 4: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/4.jpg)
What is a Memory Leak
Memory leak is when objects are not removed from the heap even when they are not required.
This can be due to application code, application server code, database driver or third party jar files.
![Page 5: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/5.jpg)
Symptoms of Memory Leak
Very frequent FULL GC Lesser memory is reclaimed on each Full GC Available free heap keeps on decreasing over time Response time decreases
![Page 6: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/6.jpg)
How to troubleshoot
Gather GC Information by adding the following JVM flags
-Xloggc=filename verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
![Page 7: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/7.jpg)
Tools
Use GC Viewer to analyze the gc log
![Page 8: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/8.jpg)
Jprofiler
Memory profiling (Class Monitor, Allocation Monitor) Heap walker (Show all Class instances,
Allocations,References) CPU profiling (Invocation Tree, Hot spots, Method
Graph,CPU statistics)
![Page 9: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/9.jpg)
Download the trail version from this link http://www.ej-technologies.com/download/jprofiler/tria
l
Follow the screenshots in the subsequent slides to configure JProfiler.
![Page 10: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/10.jpg)
![Page 11: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/11.jpg)
![Page 12: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/12.jpg)
![Page 13: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/13.jpg)
![Page 14: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/14.jpg)
![Page 15: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/15.jpg)
![Page 16: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/16.jpg)
![Page 17: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/17.jpg)
![Page 18: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/18.jpg)
![Page 19: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/19.jpg)
Best Practices to avoid or detect Memory Leak
Keep a watch on heap usage and use alert mechanisms.
Free up unnecessary objects. Close all connections in the finally block Don’t keep too much data in session.
![Page 20: Memory Leak WEBLOGIC SERVER. Overview of Java Heap What is a Memory Leak Symptoms of Memory Leaks How to troubleshoot Tools Best Practices](https://reader036.vdocuments.net/reader036/viewer/2022062300/56649cf05503460f949bf0c3/html5/thumbnails/20.jpg)
Q&A