pgraph: Fix CullableObject incorrect use of memory usage tracking
This commit is contained in:
parent
557ce7a841
commit
b6dc37cfb0
|
|
@ -43,7 +43,11 @@ alloc_object(CullableObject &&object) {
|
|||
if (page->_size >= page->_capacity) {
|
||||
page = new_page();
|
||||
}
|
||||
return new (page->_memory + sizeof(CullableObject) * (page->_size++)) CullableObject(std::move(object));
|
||||
void *ptr = page->_memory + sizeof(CullableObject) * (page->_size++);
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
//memory_hook->mark_pointer(ptr, sizeof(CullableObject), nullptr);
|
||||
#endif
|
||||
return new (ptr) CullableObject(std::move(object));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -385,6 +385,9 @@ delete_page(AllocationPage *page) {
|
|||
size_t size = std::exchange(page->_size, 0);
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
((CullableObject *)page->_memory)[i].~CullableObject();
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
//MemoryUsage::remove_void_pointer(&((CullableObject *)page->_memory)[i]);
|
||||
#endif
|
||||
}
|
||||
AllocationPage *next = page->_next;
|
||||
if (next != nullptr) {
|
||||
|
|
|
|||
|
|
@ -11,16 +11,6 @@
|
|||
* @date 2002-03-04
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates an empty CullableObject whose pointers can be filled in later.
|
||||
*/
|
||||
INLINE CullableObject::
|
||||
CullableObject() {
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::record_pointer(this, get_class_type());
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a CullableObject based the indicated geom, with the indicated
|
||||
* render state and transform.
|
||||
|
|
@ -32,9 +22,6 @@ CullableObject(CPT(Geom) geom, CPT(RenderState) state,
|
|||
_state(std::move(state)),
|
||||
_internal_transform(std::move(internal_transform))
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::record_pointer(this, get_class_type());
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -47,9 +34,6 @@ CullableObject(const CullableObject ©) :
|
|||
_state(copy._state),
|
||||
_internal_transform(copy._internal_transform)
|
||||
{
|
||||
#ifdef DO_MEMORY_USAGE
|
||||
MemoryUsage::record_pointer(this, get_class_type());
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class GeomMunger;
|
|||
*/
|
||||
class EXPCL_PANDA_PGRAPH CullableObject {
|
||||
public:
|
||||
INLINE CullableObject();
|
||||
INLINE CullableObject() = default;
|
||||
INLINE CullableObject(CPT(Geom) geom, CPT(RenderState) state,
|
||||
CPT(TransformState) internal_transform);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue