本文整理汇总了C++中GenCollectedHeap::gc_epilogue方法的典型用法代码示例。如果您正苦于以下问题:C++ GenCollectedHeap::gc_epilogue方法的具体用法?C++ GenCollectedHeap::gc_epilogue怎么用?C++ GenCollectedHeap::gc_epilogue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GenCollectedHeap
的用法示例。
在下文中一共展示了GenCollectedHeap::gc_epilogue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: heap_inspection
void HeapInspection::heap_inspection() {
ResourceMark rm;
HeapWord* permgen_bottom = NULL;
if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
gch->gc_prologue(false /* !full */); // get any necessary locks
permgen_bottom = gch->perm_gen()->used_region().start();
} else {
return;
}
// Collect klass instance info
// Iterate over objects in the heap
KlassInfoTable cit(KlassInfoTable::cit_size, permgen_bottom);
RecordInstanceClosure ric(&cit);
Universe::heap()->object_iterate(&ric);
// Sort and print klass instance info
KlassInfoHisto histo("\n"
"num #instances #bytes class name\n"
"--------------------------------------",
KlassInfoHisto::histo_initial_size);
HistoClosure hc(&histo);
cit.iterate(&hc);
histo.sort();
histo.print_on(gclog_or_tty);
gclog_or_tty->flush();
if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) {
GenCollectedHeap* gch = GenCollectedHeap::heap();
gch->gc_epilogue(false /* !full */); // release all acquired locks
}
}