我进行概要分析时出现奇怪的内存行为 [英] Strange behavior of memory when i make profiling

查看:60
本文介绍了我进行概要分析时出现奇怪的内存行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

进行概要分析时,我遇到一个奇怪的问题.我在下图中解释,我们可以很清楚地看到最大的对象仅取35mo.看到这个图: .但是,当我验证同时使用的内存时,我说它超过了500mo

I have a strange problem when i make profiling. I explain, in figure belows, we can see clairly that the greatest object take only 35mo. see this figure : . But when i verify a memory used at the same time i remark that it exceed 500mo

有人可以解释为什么为什么最大的对象同时使用最大的35mo而同时使用的堆超过了500呢?以及如何计算heap used?

Some one can explain me why the greatest object take maximum 35mo while the heap used exceed 500 for the same time ? and how calculate heap used ?

推荐答案

可能您不是在分析所有对象的创建. Netbeans中的标准配置设置之一仅对10个对象创建中的1个进行了配置.您的测量结果说35MB是您数据的51%.因此,您总共配置了70MB.这大约是您要测量的总堆大小的1/10.

Probably you are not profiling all object creations. One of the standard profiling settings in Netbeans profiles only 1 in 10 object creations. Your measurement sais 35MB is 51% of your data. So you have profiled 70MB in total. This is roughly 1/10 of what you are measuring as the total heap size.

通常,如果您正在寻找有关谁是最大的内存支出者的线索,则仅对部分创作进行测量就足够了.不跟踪所有创作的原因是性能.

In general measuring only part of the creations is enough if you are looking for clues to who is the big memory spender. The reason for not tracking all creations is performance.

如果要查看所有内存的使用位置,可以执行以下操作:

If you want to see where all your memory is used you can do the following:

在Netbeans 6.9.1中,此设置为跟踪每个...对象分配".您可以降低此数字(如果十分之一没有帮助您找到问题,也不能充分告诉您有关该应用程序的信息).但是,这可能会使您的应用程序无法运行.

In Netbeans 6.9.1 this is a setting saying 'Track every ... object allocations'. You can lower this number (if 1 in 10 doesn't help you find your problem, nor tells you enough about the application). It is possible however that this makes it impossible for your application to be run.

您还可以进行堆转储.它不会包含有关对象创建和删除的信息,但是会告诉您应用程序中当前处于活动状态的 all 个对象.

You can also make a heap dump. This will not contain information about creation and removal of objects, but it will tell you all objects currently in alive in your application.

这篇关于我进行概要分析时出现奇怪的内存行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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