Skip to Content
Java EE 8 Development with Eclipse
book

Java EE 8 Development with Eclipse

by Ram Kulkarni
June 2018
Intermediate to advanced
596 pages
12h 39m
English
Packt Publishing
Content preview from Java EE 8 Development with Eclipse

Memory tracking

VisualVM can be used to monitor memory allocations and detect possible memory leaks. Let's modify our application to simulate a large memory allocation that has not been released. We will modify the CourseService class:

public class CourseService { private CourseDAO courseDAO = new CourseDAO(); //Dummy cached data used only to simulate large //memory allocation private byte[] cachedData = null; public synchronized List<CourseDTO> getCourses() { //To simulate large memory allocation, //let's assume we are reading serialized cached data //and storing it in the cachedData member try { this.cachedData = generateDummyCachedData(); } catch (IOException e) { //ignore } return courseDAO.getCourses(); } private byte[] generateDummyCachedData() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java EE 8 Application Development

Java EE 8 Application Development

David R. Heffelfinger
Beginning EJB in Java EE 8: Building Applications with Enterprise JavaBeans

Beginning EJB in Java EE 8: Building Applications with Enterprise JavaBeans

Jonathan Wetherbee, Massimo Nardone, Chirag Rathod, Raghu Kodali

Publisher Resources

ISBN: 9781788833776Supplemental Content