Jump to content
  • Advertisement
Sign in to follow this  
AxeGuywithanAxe

DLL Memory Allocation destructors

This topic is 530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I don't know if I will be able to explain my problem well... but this is it. My engine is split into modules.. I have a base class allocator called "ITagAllocator" ... the renderer module ( a separate dll) has a function called RendererModule::CreateAllocator().. that passes back a derived class for allocation. When I'm done using the allocator I send a task to the rendering thread to destroy the allocator. The problem seems to be that the memory doesn't seem to be released. But if I create a derived class using the same exact code in my "engine" exe.. and send a task to delete it on the rendering thread... the memory is released as expected.

Share this post


Link to post
Share on other sites
Advertisement

Assuming you're talking C++, does your base class have a virtual destructor?

Without it, destruction is not passed down to the derived classes, so anything allocated by the derived class is not deleted if you destroy the base class with "delete base;"

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!