Skip to content

Commit 82360e9

Browse files
fixing the memleaks (via not running destructors on IElement derived XML nodes holding smart_refctd_ptr) was a 2 liner!
1 parent 279ca31 commit 82360e9

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

include/nbl/ext/MitsubaLoader/IElement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ template<typename T, typename TypeList>
3030
using mpl_of_passing_t = mpl_of_passing<T,TypeList>::type;
3131
}
3232

33-
class IElement
33+
class IElement : public core::IObjectPoolBase::INonTrivial
3434
{
3535
public:
3636
enum class Type

include/nbl/ext/MitsubaLoader/ParserUtil.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@ class ParserManager final
7272

7373
private:
7474
friend class ParserManager;
75-
// TODO: This leaks memory all over the place because destructors are not ran!
7675
struct PoolConfig
7776
{
7877
using AddressAllocator = core::LinearAddressAllocator<uint32_t>;
7978
using HandleValue = void*;
8079
constexpr static inline bool ThreadSafe = false;
8180
};
82-
using pool_t = core::CMemoryPool<PoolConfig>;
81+
using pool_t = core::CObjectPool<PoolConfig>;
8382
// could list transform with supported_elements_t and have a separate pool per type
8483
std::unique_ptr<pool_t> objects = std::make_unique<pool_t>(pool_t::creation_params_type{.composed={.addrAllocCtorExtraParams={},.blockSizeKBLog2=12,.initBlockCount=8}});
8584
};

src/nbl/ext/MitsubaLoader/CElementIntegrator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ bool CElementIntegrator::onEndTag(CMitsubaMetadata* metadata, system::logger_opt
214214
{
215215
}
216216

217+
// TODO: nested integrators require a deep copy away from the `CObjectPool`
217218
/* Nested integrators rely on closing branch to post-order visit here to set the root one as the main one in the metadata
218219
if (metadata->m_global.m_integrator.type!=Type::INVALID) // D
219220
{

0 commit comments

Comments
 (0)