I implemented a something like tree in c# in this way:
public class node {
public node parent = null;
public node leftChild = null;
public node rightChild = null;
}
Now in somewhere in the code I write below
node firstNode = new node();
firstNode.rightChild = new node();
firstNode.rightChild.parent = firstNode;
my question is how much memory this code allocates? As you see there isn't any variables like integer or double. I want to know in the structures like this which we don't use pointer How we should know about the memory allocation.We are sure this is stores in the memory but there is no exact variable to aggregate all of them and say this code allocates this amount of memory. I want to know "how much memory a reference to an instance costs" in the above code