I have 2 classes and both of them hold a reference to the other.
class A {
private B b;
public A(B b) {
this.b = b;
}
}
class B {
private A a;
public B() {
a = new A(this);
}
}
If it leaks memory, then how I can achieve what I want without leaking?