Getting objects anywhere in Java using IntelliJ Idea

Getting objects anywhere in Java using IntelliJ Idea

Introduction

Do you usually have a case to debug the value of objects located somewhere in your code but you don't have a breakpoint to reach these objects?

At this time the Memory debugger integrated into IntelliJ comes to rescue.


How can I use this feature?

It's straightforward you need to follow the following steps:

Step 1: Put a breakpoint somewhere in your code where you must guarantee the breakpoint will be hit.

Step 2: Open the memory view by choosing Memory of the bellow button

Step 3: Input the class you want to trace memory in the search bar then double-click to the class



At this point, you can do various things to the object like


Filter objects using expression in condition

  • Inspect: display properties of the object


  • MarkObject: named object with a label so you can evaluate this object anywhere in your code.


  • Evaluate: to debug the value, the context you type in evaluate is the current object


  • Show Referring Objects: where the object is referenced.


We can use the navigate button to quickly navigate to the class using the object.

Tien Huynh

Senior Software Engineer at FPT Software

7 个月

Insightful!

回复
Long Nguy?n

? .NET Backend Development

7 个月

Love this

Ph?m H?ng

? Backend Developer

7 个月

thanks for sharing!

要查看或添加评论,请登录

Lê Qu?c D?ng的更多文章

社区洞察

其他会员也浏览了