I am willing to write the value of a large StringBuilder
with index 827
to disk. I am trying to do that using the following OQL:
map(heap.objects('java.lang.StringBuilder'),
function(it, index) {
if (index == 827.0) {
var writer = new java.io.FileWriter("/Users/username/output/sb_0x" + it.id.toString(16) + ".txt");
var chars = it.value;
for (var i = 0; i < chars.length; i++) {
writer.write(chars[i]);
}
writer.close();
}
return index;
})
However, nothing gets written. I now that the builder exists, since I have inspected it:
It seems that the result gets truncated after the builder with index 99
(i.e. it works for 99, but doesn't work for 100):
Any suggestions how can I get the value of the StringBuilder with id 827?