简体   繁体   中英

Track out of memory exception in java web application

I am working on a web application which reads file and give me searched string with line number and other details, For that, I am using following technologies:

  1. Spring MVC
  2. DWR reverse AJAX

FTP and share location files, I am reading using this app.

Every time , I am doing search, it is showing "outofmemory" exception. is it there any tool available where I can watch which part of code is creating problem exactly?

I tried jConsole, MAT and other tools but all are looking complex as I am new in performance testing.

You can simply try with jVisualVM, which is available with your JDK if you're using a recent version of Java. ( docs )

It will give you the ability to hook to a running process, including your local application server, and to generate heap dumps to examine what's heating your memory.

It's generally good enough for most low-level memory profiling / mem-leak hunting requirements.

Though that being said, MAT would probably allow you to do exactly the same thing and has similar complexity, so I suspect you might have to buckle up and read a tutorial or two on how to use it. This blogpost gives a decent introduction on analyzing memory leaks in a Java applicationjVisualVM .

A OutOfMemoryError is thrown when you have too many RAM used. Try to find out where you store very much data, eg in a List that is never cleared.

If you can't find the error, create a Heap Dump. Then, open it and look what rubs your memory. A great tutorial is here: https://blog.codecentric.de/2011/08/java-heapdumps-erzeugen-und-verstehen-4-akt/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM