• Advertisement
Sign in to follow this  
  • entries
    2
  • comments
    5
  • views
    1111

Memory Management Thoughts - ( C++ )

Sign in to follow this  

194 views

Hello again. Well, I was playing around with different ideas for memory management. First, I'll list the two main methods I found.


  • Overloading the New and Delete operators to allow for debugging information.
  • Creating a self-managing memory manager class that outputs debugging information


Now, I'll go ahead and discuss each of the methods and the pros/cons I found for each of them.

Overloading the New and Delete operators to allow for debugging information

Pros:

  • Can provide you with extremely useful debugging information on allocations with New/Delete.
  • Manages itself.


Cons:

  • Alot of overhead, you'd be storing debugging info on EVERY allocation, and removing it every DEALLOCATION.
  • Makes it harder to create a garbage collector.
  • Cannot use reference counting ( Kind of goes hand in hand with the above point.


Creating a self-managing memory manager class that outputs debugging information.

Pros:

  • Can provide you with extremely useful debugging information, as well as manage itself.
  • Makes it easier to create a garbage collector.
  • Can use reference counting.
  • Not alot of overhead, since the overloads of New/Delete operators aren't global.


Cons:

  • Cannot be applied to existing code without a lot of extra work.


I'll post code for each of these later.
Sign in to follow this  


3 Comments


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement