对现有java软件进行记忆分析。 是否在 o克液中存在一个等效组,以看到具有相同价值但不同情况的物体。
select count(*) from java.lang.String s group by s.toString()
因此,我要提出一个重复铺设的插座清单以及复制件数。 这样做的目的是看到大量案件,以便利用Sting.intern()优化这些案件。
例:
"foo" 100
"bar" 99
"lazy fox" 50
......
对现有java软件进行记忆分析。 是否在 o克液中存在一个等效组,以看到具有相同价值但不同情况的物体。
select count(*) from java.lang.String s group by s.toString()
因此,我要提出一个重复铺设的插座清单以及复制件数。 这样做的目的是看到大量案件,以便利用Sting.intern()优化这些案件。
例:
"foo" 100
"bar" 99
"lazy fox" 50
......
The following is based on the response by Peter Dolberg, and can be used in the OQL Console:
var counts={};
var alreadyReturned={};
filter(
sort(
map(heap.objects("java.lang.String"),
function(heapString){
if( ! counts[heapString.toString()]){
counts[heapString.toString()] = 1;
} else {
counts[heapString.toString()] = counts[heapString.toString()] + 1;
}
return { string:heapString.toString(), count:counts[heapString.toString()]};
}),
lhs.count < rhs.count ),
function(countObject) {
if( ! alreadyReturned[countObject.string]){
alreadyReturned[countObject.string] = true;
return true;
} else {
return false;
}
}
);
首先是使用<条码>地图(<>>>>>,指所有强势情况,并指每一方在<条码>上制造或更新物体。 每一物体都有<条码>载条码>和<条码>>>>。
The resulting array will contain one entry for each String instance, each having a count
value one larger than the previous entry for the same String.
The result is then sorted on the count
field and the result looks something like this:
{
count = 1028.0,
string = *null*
}
{
count = 1027.0,
string = *null*
}
{
count = 1026.0,
string = *null*
}
...
(在我的测试中,Sting *null*>
是最常见的。)
最后一个步骤是利用一种功能来过滤这种功能,这种功能在每一强令的首次出现时都是真实的。 它使用<条码>翻新后条码>阵列,以跟踪已纳入其中的轨迹。
页: 1 Eclipse Memory Analyzer.
令人痛心的是,在荷兰,有相当于“按组别”的吨位。 我假定你再谈一下在 j子和视力仪中使用的低价竞标。
但有选择。 如果你使用纯粹的Java syntax而不是“slectx from y” syntax,那么你就完全有能力与Javagust公司合作。
即便如此,获得你所寻求的信息的另一种方式也不简单。 例如,这里有一个将履行与你的询问相同任务的联络处“主席团”:
var set={};
sum(map(heap.objects("java.lang.String"),function(heapString){
if(set[heapString.toString()]){
return 0;
}
else{
set[heapString.toString()]=true;
return 1;
}
}));
In this example a regular JavaScript object mimics a set (collection with no duplicates). As the the map function goes through each string, the set is used to determine if the string has already been seen. Duplicates don t count toward the total (return 0) but new strings do (return 1).
提高效率:
var countByValue = {};
// Scroll the strings
heap.forEachObject(
function(strObject) {
var key = strObject.toString();
var count = countByValue[key];
countByValue[key] = count ? count + 1 : 1;
},
"java.lang.String",
false
);
// Transform the map into array
var mapEntries = [];
for (var i = 0, keys = Object.keys(countByValue), total = keys.length; i < total; i++) {
mapEntries.push({
count : countByValue[keys[i]],
string : keys[i]
});
}
// Sort the counts
sort(mapEntries, rhs.count - lhs.count );
Just post my solution and experience when doing similar issue for other references.
var counts = {};
var alreadyReturned = {};
top(
filter(
sort(
map(heap.objects("java.lang.ref.Finalizer"),
function (fobject) {
var className = classof(fobject.referent)
if (!counts[className]) {
counts[className] = 1;
} else {
counts[className] = counts[className] + 1;
}
return {string: className, count: counts[className]};
}),
rhs.count-lhs.count ),
function (countObject) {
if (!alreadyReturned[countObject.string]) {
alreadyReturned[countObject.string] = true;
return true;
} else {
return false;
}
}),
"rhs.count > lhs.count", 10);
The previous code will output the top 10 classes used by java.lang.ref.Finalizer.
Tips:
1. The sort function by using function XXX is NOT working on my Mac OS.
2. The classof function can return the class of the referent. (I tried to use fobject.referent.toString() -> this returned a lot of org.netbeans.lib.profiler.heap.InstanceDump. This also wasted a lot of my time).
你们可以选择所有的护卫,然后利用终点站将其集中起来。
sort | uniq -c
to get the counts.Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...