如何确定数据结构的实际内存使用情况 [英] How to determine the actual memory usage of a data structure

查看:213
本文介绍了如何确定数据结构的实际内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数据结构中,我知道结构的大小取决于从一个部分到另一个部分的内部链接。有没有办法,除了JProfiler,以确定在特定结构中绑定了多少内存?

In data structures, I know that the size of the structure depends on the internal links from one section to another. Is there a way, aside from JProfiler to tell exactly how much memory is tied up in a particular structure?

例如,本学期的类项目与应用程序有关各种结构到歌曲数据库。这些项目涵盖了数组,列表,展开列表和树。我想做的是看看有多少内存被使用。例如,一个链表的内存需求为3N,但我想看看节点在我的项目中占用了多少空间。

For example, the class project this semester has to do with applying various structures to a song database. The projects have covered arrays, lists, unrolled lists and trees. What I would like to do is see how much memory is used. For example, a linked list has a memory requirement of 3N, but I would like to see how much space a node is taking up in my project.

JProfiler看起来像将工作,但$ 500是在我的价格范围之外,我想使用它为所有这个学期涵盖的结构,而不是三个应用到目前为止。

JProfiler looks like it would work, but $500 is out of my price range, and I would like to use it for all the structures covered this semester, not the three applied so far.

推荐答案

使用 VisualVM 。它与JDK一起提供,并允许您拍摄堆的快照。

Use VisualVM. It comes with the JDK and allows you to take a snapshot of the heap.

这篇关于如何确定数据结构的实际内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆