Sign in to follow this  

[c++] Memory leaks

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

Hi! I wrote a little game application just for try a graphic engine, and when I looked for memory leaks with _CrtDumpMemoryLeaks() the result was:
Detected memory leaks!
Dumping objects ->
{139} normal block at 0x004E4D00, 1 bytes long.
 Data: < > 00 
{138} normal block at 0x004E4CC0, 1 bytes long.
 Data: < > 00 
{137} normal block at 0x004E4C80, 1 bytes long.
 Data: < > 00 
{136} normal block at 0x004E4C40, 1 bytes long.
 Data: < > 00 
Object dump complete.
I checked again my code and all seemed be ok. So, I tried with a empty main() and the result was the same.. Why?

Share this post


Link to post
Share on other sites
You can try to use debug function to break to the given allocation:

#include <crtdbg.h>

// Put in first line of main().
_CrtSetBreakAlloc(136);

If the allocation happens before main(), ie from global objects, you can try to to set the breakpoint in the Watch window

Share this post


Link to post
Share on other sites
Now my code is:


#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>

int main()
{
_CrtSetDbgFlag( _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );

_CrtDumpMemoryLeaks();

return 0;
}


and I still have leaks problems.
I tried to set breakpoints on a memory allocation number but nothing happened.

Share this post


Link to post
Share on other sites

This topic is 2848 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.

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

Sign in to follow this