'What is the memory usage of a reference to another object in java?
If for example, I had a linked list of nodes. Each having a field referencing the next node. How much memory does this reference (not the next object) take?
E.g if I have:
Class Node
nextNode node;
public Node(node nextNode){
this.nextNode = nextNode;
}
Does the nextNode field take any memory? If I read correctly, the reference takes 4 bytes, but I'm unsure as I find conflicting information. Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
