Skip to content

Instantly share code, notes, and snippets.

@Toparvion
Last active August 25, 2022 04:31
Show Gist options
  • Save Toparvion/adec9052ad23e85e54d72b5bfb5a1aa3 to your computer and use it in GitHub Desktop.
Save Toparvion/adec9052ad23e85e54d72b5bfb5a1aa3 to your computer and use it in GitHub Desktop.
A unit test demonstrating the difference in JOL's layout and stats graph walkers (fails on v0.16)
package org.openjdk.jol.info;
import org.junit.Assert;
import org.junit.Test;
public class WalkersDifferenceTest {
static class A {
}
static class B {
private final A[] bs;
B() {
bs = new A[] { new A() };
}
}
@Test
public void layoutAndStatsDifference() {
B b = new B();
GraphLayout layout = GraphLayout.parseInstance(b);
GraphStats stats = GraphStats.parseInstance(b);
Assert.assertEquals(layout.totalSize(), stats.totalSize());
Assert.assertEquals(layout.totalCount(), stats.totalCount());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment