• Stars
    star
    141
  • Rank 259,971 (Top 6 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Intellij plugin that shows an object layout in memory to help optimize it. Uses OpenJDK JOL tool

Java Object Layout (JOL) plugin for IntelliJ Idea

JOL (Java Object Layout) is the tool to analyze object layout schemes in JVMs. For example, in HotSpot VM on 64x processor an empty string takes 40 bytes i.e. 24 bytes for String object itself + 16 bytes for an internal empty char array.

The plugin is a GUI for JOL and allows you to make an estimate how much memory the object takes.

Set a cursor into a class name and then press Code / Show Object Layout and you'll see a right panel with layout info.

screenshot.png

Thus, you can perform simplest but most efficient performance improvements. Just check your DTOs if they fit into 64 bytes of processor's cache line.

Only HotSpot VM is supported by JOL itself. The plugin supports only basic estimate of class layout in different VM modes i.e. the same as jol-cli estimates command. For more precise estimate use JOL library and estimate in run time on the real objects with GraphLayout:

import org.openjdk.jol.info.GraphLayout;
import java.util.HashMap;

public class JolTest {

    public static void main(String[] args) {
        HashMap<Object, Object> hashMap = new HashMap<>();
        hashMap.put("key", "value");
        System.out.println(GraphLayout.parseInstance(hashMap).toFootprint());
    }
}

Output will be like:

java.util.HashMap@7a79be86d footprint:
     COUNT       AVG       SUM   DESCRIPTION
         2        24        48   [B
         1        80        80   [Ljava.util.HashMap$Node;
         2        24        48   java.lang.String
         1        48        48   java.util.HashMap
         1        32        32   java.util.HashMap$Node
         7                 256   (total)

So you can see the full size including inner objects.

NOTE: Your app most likely will use the HotSpot with 64-bit VM, compressed references mode.

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "JOL" > Install Plugin

  • Manually:

    Download the latest release and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...

Inspection

The plugin provides an inspection to see most big classes. It's enabled by default. You can find the inspection by path Java | Memory | JOL: Class has too big memory footprint to configure or disable it.

Please rank the Plugin to make it more searchable.

Related projects

Heap dump *.hprof files analysers:

More Repositories

1

fortress-lang

Java
51
star
2

gag

This project is a fork of Google Annotation Gallery
Java
45
star
3

grails-cookie

Makes dealing with cookies easy. Provides an injectable service and tag to easily get, set, and delete cookies with one line
Groovy
16
star
4

IdeaSingletonInspection

Inspection for detecting of inappropriate use of Singleton pattern in Java
Kotlin
14
star
5

pidgin-fchat

FChat protocol plugin for libpurple (Pidgin, Adium)
C
13
star
6

OCPJP

Интересные задачки из экзамена Oracle Certified Professional Java Programmer
Java
12
star
7

FreeTTSLog4JAppender

Talking log appender to keep your eyes :)
Java
9
star
8

grails-locale-configuration-plugin

This plugin is intended to enhance the language support in Grails by detecting your users’ locale and selecting the most appropriate language for them. You can specify a list of supported languages and choose which language to use if a client’s preferred language is not available.
Shell
9
star
9

grub-invaders

GRUB Inviders game
C
8
star
10

phonegap-quick-start-tutorial

PhoneGap Quick start guide
8
star
11

openwrt-ubuntu

PPA for OpenWrt on Ubuntu
Makefile
6
star
12

deflate

deflate is low level gzip utility based on zlib to create a deflate streams i.e. gzip without checksum
C
6
star
13

javafx-calculator

Calculator based on JavaFX, JUnit, Spock, Kotlin
Groovy
4
star
14

gag-demo

This project is a fork of Google Annotation Gallery
Java
4
star
15

go-logger-noalloc

Essential logger that avoids memory allocations
Go
3
star
16

java-live-coding-tasks

A small task for live coding on an interview
Java
3
star
17

jsmallmap

Java
3
star
18

jedicodeformat

Pascal
3
star
19

idea-inspections-list

List of all inspections in IntelliJ Idea
Java
2
star
20

eng

Composer of English sentences
Java
2
star
21

go-http-server-basic-auth

Simplest basic authentificator
Go
2
star
22

go-gzip-buf-file

gzip compressed log/file
Go
2
star
23

jshn-jsonc

Fork of OpenWrt jshn that doesn't have a dependency to libubox
C
2
star
24

upnp-router-control

[mirror] A GTK application to access the parameters of the router exposed via UPnP-IGD. Access to network speed, external IP and model name. It can manage port forwarding through a simple GUI interface.
C
2
star
25

cafebabe-idea-plugin

Automatically exported from code.google.com/p/cafebabe-idea-plugin
Java
1
star
26

adyen-java-sample

Java
1
star
27

JavaCodeAnalyzer

Demo application for article "Source Code Analysis Using Java 6 APIs"
Java
1
star
28

grails-private-messages

Plugin that allow your users to send private messages to each others
Groovy
1
star
29

delphi-goodnes

Old time Delphi units with some useful functions
Pascal
1
star
30

myconf

MyConf
Java
1
star
31

ebpf-web-proxy

HTTP proxy based on eBPF rules to redirect traffic on packet level
1
star
32

s2-brutforce-example

Demo application for Grails Brut Force Defender Plugin https://github.com/grygoriy/bruteforcedefender
Groovy
1
star
33

busybox

C
1
star
34

IdeaInspections

Java
1
star
35

player-level-service

Java
1
star
36

go-str2bytes

Golang Bytes slice to string and string to byte slice conversion
Go
1
star
37

jpatterns-annotations-processor

Java Design Pattern Annotations Processor
1
star
38

memeater

Memory Eater program to simulate Out Of Memory error inside JVM and Docker container
Java
1
star
39

jmh-jol-experiments

Java experiments and benchmarks
Java
1
star
40

rpn-calc

Java RPN calculator example
Java
1
star
41

prefixed_str_bench

benchmark for strncasecompare version for prefixed strings
C++
1
star
42

grails-settings

Update version of the plugin for Grails 2.0.0
CSS
1
star
43

FreeTTSLog4JDemo

Demo application how to use Voice talking FreeTTS Log4J Appender
CSS
1
star
44

jep277

JEP 277 Enhanced Deprecation
Java
1
star
45

go-http-body

Read http.Request body quickly and in effective way
Go
1
star
46

grails-locale-configuration-plugin-demo

This plugin is intended to enhance the language support in Grails by detecting your users’ locale and selecting the most appropriate language for them. You can specify a list of supported languages and choose which language to use if a client’s preferred language is not available.
Shell
1
star