Skip to content

Instantly share code, notes, and snippets.

@martint
Created June 9, 2009 20:30
Show Gist options
  • Save martint/126764 to your computer and use it in GitHub Desktop.
Save martint/126764 to your computer and use it in GitHub Desktop.
public class A {
private final int dataSize = (int) (Runtime.getRuntime().maxMemory() * 0.6);
public void f()
{
{
byte[] data = new byte[dataSize];
}
byte[] data2 = new byte[dataSize];
}
public static void main(String[] args)
{
A a = new A();
a.f();
}
}
public class B {
private final int dataSize = (int) (Runtime.getRuntime().maxMemory() * 0.6);
public void f()
{
{
byte[] data = new byte[dataSize];
}
int i = 0;
byte[] data2 = new byte[dataSize];
}
public static void main(String[] args)
{
B b = new B();
b.f();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment