Skip to content

erlioniel/memory-eaters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java Memory Leaks

This repository is the result of preparation for internal talk in Intrum Global Technologies to share my knowledge about how the memory leaks are working, what the usual cases for them and how to spot & fix them.

Talk Agenda

  • What's a memory leak?
    • Java GC under the hood
    • Passing object by reference
  • The common leak cases
    • Overload buffers - Zoe DEMO
    • Unclosed connections / buffers
    • Hidden infinite cycle - Bart DEMO
    • Anonymous class context memory leak - Evelyn DEMO
  • Tools to debug
    • Visual VM
    • Eclipse Memory Analyzer
  • Questions

Suspect a leak?

  • Check amount of free memory after GC right after app startup and some time after
  • Try to get HEAP dump and analyze it
  • Try to figure out what is allocated in memory for your application
  • Remember that memory leak not always looks like a memory leak, but usually as an overload CPU (because of infinite GC)

Run details

java \
   -verbose:gc \
   -Xmx25M \
   -Dcom.sun.management.jmxremote \
   -Dcom.sun.management.jmxremote.port=9010 \
   -Dcom.sun.management.jmxremote.local.only=false \
   -Dcom.sun.management.jmxremote.authenticate=false \
   -Dcom.sun.management.jmxremote.ssl=false \
memory.MemoryEaterBart

Tools

About

Just some memory leak stuff

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages