💻
Best on Larger Screens
JavaMem visualizes heap, stack, and memory arrows in real-time. On small screens the layout gets very tight.

Open on a laptop or tablet for the full experience.
✓ Laptop — Perfect ✓ Tablet — Great
Stack Vars
0
Heap
0
Pool
0
100%
Code Editor
1
Ready — Ctrl+Enter to run
Call Stack
1 frame active main()
Write Java code
and press ▶ Run
▁ STACK BASE ▁
Heap · GC managed · objects live here
🧩Objects appear here
String Pool ↑ lives inside the Heap (Java 7+) — not a separate memory area
🏊Interned strings here
⏏ End of Scope
Select variables to pop off the stack. Orphaned heap objects become GC-eligible and will be collected after a delay.

☕ JavaMem — Syntax Reference

Primitives

int age = 25;
double gpa = 9.5;
boolean active = true;
char grade = 'A';

Strings

String name = "Alice";           // → String Pool (inside Heap)
String s = new String("Alice");  // → Heap (new object, not pooled)

Arrays

int[] scores = {95, 87, 76};

ArrayList

ArrayList<Integer> list = new ArrayList<>();
list.add(10);
list.add(20);

Stack

Stack<String> stk = new Stack<>();
stk.push(A);
stk.push(B);
stk.pop();

LinkedList

LinkedList<Integer> ll = new LinkedList<>();
ll.add(10);
ll.add(20);
ll.add(30);
ll.remove(20);

HashMap / TreeMap / LinkedHashMap

HashMap<String,String> map = new HashMap<>();
map.put(name, Alice);
TreeMap<String,String> tm = new TreeMap<>();
LinkedHashMap<String,String> lhm = new LinkedHashMap<>();

HashSet / TreeSet

HashSet<String> set = new HashSet<>();
set.add(apple);
TreeSet<String> ts = new TreeSet<>();

BST — Binary Search Tree

BST tree = new BST();
tree.add(50);
tree.add(30);
tree.add(70);
tree.remove(30);

Integer Wrapper

Integer a = 100;  // from Integer cache [-128..127]
Integer b = 200;  // new heap object — always use .equals()

Scope Pop

Click ⏏ Scope → select variables → Pop Selected
Orphaned objects become GC-eligible and are collected after a delay.
Drag any heap object to reposition · ⊞ auto-arranges · zoom with − / +