pgraph: Track CullableObject memory usage
This commit is contained in:
parent
9427f2b590
commit
d65e46e7b7
|
|
@ -65,7 +65,10 @@ CullResult(GraphicsStateGuardianBase *gsg,
|
|||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::update_type(this, get_class_type());
|
||||
#endif
|
||||
|
||||
CullableObject::get_class_type().inc_memory_usage(
|
||||
TypeHandle::MC_array, sizeof(CullableObject) * AllocationPage::_capacity);
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
||||
#ifndef NDEBUG
|
||||
_show_transparency = show_transparency.get_value();
|
||||
|
|
@ -372,6 +375,10 @@ make_new_bin(int bin_index) {
|
|||
CullResult::AllocationPage *CullResult::
|
||||
new_page() {
|
||||
AllocationPage *page = new AllocationPage;
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
CullableObject::get_class_type().inc_memory_usage(
|
||||
TypeHandle::MC_array, sizeof(CullableObject) * AllocationPage::_capacity);
|
||||
#endif // DO_MEMORY_USAGE
|
||||
page->_next = _page;
|
||||
_page = page;
|
||||
return page;
|
||||
|
|
@ -389,6 +396,12 @@ delete_page(AllocationPage *page) {
|
|||
//MemoryUsage::remove_void_pointer(&((CullableObject *)page->_memory)[i]);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
CullableObject::get_class_type().dec_memory_usage(
|
||||
TypeHandle::MC_array, sizeof(CullableObject) * AllocationPage::_capacity);
|
||||
#endif // DO_MEMORY_USAGE
|
||||
|
||||
AllocationPage *next = page->_next;
|
||||
if (next != nullptr) {
|
||||
delete_page(next);
|
||||
|
|
|
|||
Loading…
Reference in New Issue