diff --git a/panda/src/pgraph/cullResult.I b/panda/src/pgraph/cullResult.I index a0ea58eb3f..76e11fbd49 100644 --- a/panda/src/pgraph/cullResult.I +++ b/panda/src/pgraph/cullResult.I @@ -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)); } /** diff --git a/panda/src/pgraph/cullResult.cxx b/panda/src/pgraph/cullResult.cxx index d4b1550935..0caa7231a7 100644 --- a/panda/src/pgraph/cullResult.cxx +++ b/panda/src/pgraph/cullResult.cxx @@ -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) { diff --git a/panda/src/pgraph/cullableObject.I b/panda/src/pgraph/cullableObject.I index 3910903948..6c1906bc79 100644 --- a/panda/src/pgraph/cullableObject.I +++ b/panda/src/pgraph/cullableObject.I @@ -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 } /** diff --git a/panda/src/pgraph/cullableObject.h b/panda/src/pgraph/cullableObject.h index 46fdc228c6..26f1f7674f 100644 --- a/panda/src/pgraph/cullableObject.h +++ b/panda/src/pgraph/cullableObject.h @@ -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);