Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Evil Steve


Memory managers for everyone!

MemMgr.h and MemMgr.cpp

Example usage:

int main(int, char**)
int* n = new int[42];
return 0;

That'll give you debug spew at application shutdown, and write to memleaks.log, then debug break. The debug spew is the same as you get in memleaks.log, and is:

1 active allocations totalling 168 bytes:
+ ID 00000002, tag ID 0x00000000: 0x00356B84 168 bytes [main.cpp:9 (main)]
End of allocations

The code only works on Windows, and should work fine on x64. It's ported from my engine code, but I've just changed a few things (Like the assert doesn't use my engine's assert(), and the _WIN64 define is actually BUILD_X64 in my engine).
It'll also only work on Visual Studio, due to my #pragma black magic. Only tested on VC2005 so far.

Any questions, give me a shout. I'm going to post this in General Programming now. EDIT: Done.
Sign in to follow this  


Recommended Comments

Does this also work with STL?

I remember using MMGR by Paul Nettle. (http://www.paulnettle.com/)
And that couldn't be used with STL.

[EDIT] Never mind... Should have read the post first. ^_^'

Share this comment

Link to comment
Yup, it does. I've used MMGR before, and I got really annoyed having to piss around with the order of includes to make sure MMGR wasn't included before STL headers [smile]

Share this comment

Link to comment

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

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!