The warning message is:
WARNING: Ran out of C-heap; undercounted 26 total instances in data below
but we didn't run out of C-heap.
The code path is:
size_t missed_count = populate_table(&cit);
if (missed_count != 0) {
st->print_cr("WARNING: Ran out of C-heap; undercounted " SIZE_FORMAT
" total instances in data below",
missed_count);
}
---
size_t HeapInspection::populate_table(KlassInfoTable* cit, BoolObjectClosure *filter) {
ResourceMark rm;
RecordInstanceClosure ric(cit, filter);
Universe::heap()->object_iterate(&ric);
return ric.missed_count();
}
---
void do_object(oop obj) {
if (should_visit(obj)) {
if (!_cit->record_instance(obj)) {
_missed_count++;
}
}
}
---
bool KlassInfoTable::record_instance(const oop obj) {
Klass* k = obj->klass();
KlassInfoEntry* elt = lookup(k);
// elt may be NULL if it's a new klass for which we
// could not allocate space for a new entry in the hashtable.
if (elt != NULL) {
elt->set_count(elt->count() + 1);
elt->set_words(elt->words() + obj->size());
_size_of_instances_in_words += obj->size();
return true;
} else {
return false;
}
}
---
KlassInfoEntry* KlassInfoTable::lookup(Klass* k) {
uint idx = hash(k) % _num_buckets;
assert(_buckets != NULL, "Allocation failure should have been caught");
KlassInfoEntry* e = _buckets[idx].lookup(k);
// Lookup may fail if this is a new klass for which we
// could not allocate space for an new entry, or if it's
// an archived class that we haven't loaded yet.
assert(e == NULL || k == e->klass(), "must be equal");
return e;
}
See the last comment.
WARNING: Ran out of C-heap; undercounted 26 total instances in data below
but we didn't run out of C-heap.
The code path is:
size_t missed_count = populate_table(&cit);
if (missed_count != 0) {
st->print_cr("WARNING: Ran out of C-heap; undercounted " SIZE_FORMAT
" total instances in data below",
missed_count);
}
---
size_t HeapInspection::populate_table(KlassInfoTable* cit, BoolObjectClosure *filter) {
ResourceMark rm;
RecordInstanceClosure ric(cit, filter);
Universe::heap()->object_iterate(&ric);
return ric.missed_count();
}
---
void do_object(oop obj) {
if (should_visit(obj)) {
if (!_cit->record_instance(obj)) {
_missed_count++;
}
}
}
---
bool KlassInfoTable::record_instance(const oop obj) {
Klass* k = obj->klass();
KlassInfoEntry* elt = lookup(k);
// elt may be NULL if it's a new klass for which we
// could not allocate space for a new entry in the hashtable.
if (elt != NULL) {
elt->set_count(elt->count() + 1);
elt->set_words(elt->words() + obj->size());
_size_of_instances_in_words += obj->size();
return true;
} else {
return false;
}
}
---
KlassInfoEntry* KlassInfoTable::lookup(Klass* k) {
uint idx = hash(k) % _num_buckets;
assert(_buckets != NULL, "Allocation failure should have been caught");
KlassInfoEntry* e = _buckets[idx].lookup(k);
// Lookup may fail if this is a new klass for which we
// could not allocate space for an new entry, or if it's
// an archived class that we haven't loaded yet.
assert(e == NULL || k == e->klass(), "must be equal");
return e;
}
See the last comment.
- duplicates
-
JDK-8232758 The jcmd GC.class_stats produces warning: Ran out of C-heap; undercounted
-
- Closed
-
- relates to
-
JDK-8235334 Deprecate jcmd GC.class_stats
-
- Resolved
-