Jump to content
  • Advertisement
Sign in to follow this  
Gink

overloaded new/delete useful?

This topic is 4817 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

I was wondering if people actually overload these operators, and what reason would there be for doing so? Isnt the default one good enough?

Share this post


Link to post
Share on other sites
Advertisement
Memory logging / instrumentation is one possible usage, also providing customized allocators (object pools, chunked etc) can provide real performance benefits and avoid fragmentation of the global heap.

So yes, there can be a real benefit in overloading them but it's actually quite safe to not do so until, as always, profiling shows otherwise.

Share this post


Link to post
Share on other sites
The global new and delete operators - rarely. To customize a class's memory allocation - more often. See for example, Loki::SmallObject.

Share this post


Link to post
Share on other sites
It's a convenient way to record memory allocations/deallocations without having to use a custom function.

I did this a while back to keep track of how much memory was dynamically allocated at any given time. With a simple "bookmark" system I could track down memory leaks easily, though I never actually used the sytem and eventually trashed it because it was taking up space [smile]

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!