My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Wiki pages
Links

Introduction

Javadocs

A small tool that is very handy when e.g. you design data structures and want to see how much memory each one uses. To do this, it uses a simple reflection-based object-traversing framework (ObjectExplorer). On it, it builds two facilities:

  • MemoryMeasurer, which can estimate the memory footprint of an object graph in bytes. This requires installing a javaagent when running the JVM, e.g. by passing -javaagent:path/to/object-explorer.jar.
  • ObjectGraphMeasurer does not need a javaagent, and can also give a much more qualitative measurement than MemoryMeasurer - it counts the number of objects, references, and primitives (of each kind) that an object graph entails.

Also of interest is the synergy with this project (of yours truly) : JBenchy

Put together, they allow you to easily and systematically run and analyze benchmarks regarding data structures.

How to use

An extremely simple example:

long memory = MemoryMeasurer.measureBytes(new HashMap());

or

Footprint footprint = ObjectGraphMeasurer.measure(new HashMap());
Powered by Google Project Hosting