Video is locked.

Unlock this course with a free trial

Join today to access over 15,000 courses taught by industry experts.

Java Memory Management

Exercise walkthrough

From the course: Java Memory Management

  • Course details

    By taking the time to learn how memory works in Java, you can avoid introducing problems in your code, as well as more effectively find and fix any memory errors that still occur. In this hands-on course, join instructor Matt Greencroft as he details how memory works in Java. Matt goes over essential concepts such as the roles of the stack and the heap, escaping references, garbage collection, detecting soft leaks, and more. Plus, he lends a real-world context to these concepts by demonstrating how to hunt for—and fix—a memory leak in a sample Java web application. While Matt works with Eclipse and Java 8 throughout the course, the material he covers is valid for any IDE and Java 6 and above.


    • Click here to view Matt Greencroft’s instructor page

      Matt Greencroft

      Director at Capability Training & Management Ltd

      • Matt Greencroft is a full-time trainer and software development consultant.

        Matt works to design and deliver a range of Java-related training courses for the Virtual Pair Programmers brand. With these courses, he helps everyone from beginners to Java experts boost their coding skills. In addition to tech education, Matt uses his gift for public speaking as a professional toastmaster and master of ceremonies.

    Skills covered in this course

  • Introduction

    - [Instructor] So I'm not going to walk through this exercise now. Obviously, I've got a limited size screen and it can be a little bit difficult to get everything that's relevant to show you on screen at the same time and things might look a little bit messy but bear with me and hopefully this will make sense. We start in the main class and in the main method of the main class. Now there will be a variable called args which is going to be on the stack but I'm not going to include this in my diagram as we aren't using that variable in any of the code. So the first line in the main method creates a new instance of the main class and it assigns it to a variable called main. So there'll be an object on the heap of type main and there'll be a reference to that object on the stack with the name of main with a lowercase m. Our code then calls the start method in the instance of our main class. So the first thing that happens in the start method is we get a variable called last which has a…

  • Practice while you learn with exercise files

    Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.

    Download the exercise files for this course. Get started with a free trial today.

  • Download courses and learn on the go

    Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.

    Watch this course anytime, anywhere. Get started with a free trial today.