   how to detect leaks?
  I think my program might be leaving some memory in use when it exits.  How can I easily detect any memory leaks?Thanksforgot to add, its in c++ using msvc 6   
  I would suggest using Fluid Studios's MMGR. You add in those files to your project (1 cpp, 1 on .h, and 1 off .h) then you can include the header file and it's all tracked! There are further instructions in the files themselves as well.   ;  Rather than checking for a leak after the fact, it may be wise to prevent them in the first place.Have you debugged your code? That's a good way of telling.;  An easy way to detect memory leak is to use premade softwares dedicated for this thing. There're many commercial libraries which can seemlessly integrate to your application, but they're 'commercial'.You can try  Fluid Studio's Memory manager, which is a free one (and good enough for its cost).   ;  I was hoping for something kind of simpler, like under DOS, I used to be able to call some command at the start of the program to tell me how much memeory was available, and then at the end of the program, call it again, and see if the values were the same or not.Is there anything like that in vc++ I could use?;  Let me say that, FluidStudios MMGR is an easy one to use. You just...Quote:...add in those files to your project (1 cpp, 1 on .h, and 1 off .h) then you can include the header file and it's all tracked!To fulfill your question, I think  _CrtDumpMemoryLeak () is applicable as well. But it's not that easier than Fluid's.Edit: Oh, I wrote _CrtDumbMemoryLeak, it's not so dumb of course :-p   ;  "valgrind" in memcheck mode helps alot ... http://valgrind.org/   ;  Thanks for all the help, i think ill try the fluid studios mem manager.I appreciate all the replies :);  [edit]Ah, glad you changed your mind [wink] It really is the best IMO, not to mention best of all, free! [grin]Quote:Original post by SelethDIs there anything like that in vc++ I could use?Sure, but I you really should put forth the effort for MMGR, it really is a great tool to use. Take a look at this page from exactly what you have asked. Of course though, you have to do it programatically rather than use another .exe.   ;Quote:Original post by Drew_BentonI would suggest using Fluid Studios's MMGR. You add in those files to your project (1 cpp, 1 on .h, and 1 off .h) then you can include the header file and it's all tracked! There are further instructions in the files themselves as well.I used that for a while, completely without issue. I used to enjoy the feeling of seeing an empty memleaks.log file.. it was almost perverse [wink]However, I then tried to use it at the same time I used RakNet, which caused MMGR to sometimes (completely at random as well) try and deallocate memory allocated by RakNet on its own. RakNet had no MMGR includes, but MMGR was somehow forcing it's way into the static lib during run-time and then complaining because the memory to-be-deallocated didn't have a MMGR allocation record.It was really wierd, and eventually forced me to stop using MMGR.   