对Java中另一个对象的引用的内存用法是什么?
例如,如果我有一个链接的节点列表。每个都有一个字段引用下一个节点。此引用(不是下一个对象)需要多少内存?
例如,如果我有:
Class Node
nextNode node;
public Node(node nextNode){
this.nextNode = nextNode;
}
NextNode字段是否有任何内存?如果我正确阅读,则参考需要4个字节,但是由于发现相互矛盾的信息,我不确定。 谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论