Memory leak searcher?
-
Dear all, Correct me if I'm wrong, is memory leak due to not using
delete
after anew
? Is there a program to check my program for memory leak? Thanks Chun Te, Ewe -
Dear all, Correct me if I'm wrong, is memory leak due to not using
delete
after anew
? Is there a program to check my program for memory leak? Thanks Chun Te, EweChun Te, Ewe wrote: Correct me if I'm wrong, is memory leak due to not using delete after a new? Yes. Or using
delete
instead ofdelete[]
for an array made withnew[]
Chun Te, Ewe wrote: Is there a program to check my program for memory leak? 'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good. -
Dear all, Correct me if I'm wrong, is memory leak due to not using
delete
after anew
? Is there a program to check my program for memory leak? Thanks Chun Te, EweIf that's window objects such like GDI handles, this article [^](and tool) may help you.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
-
Chun Te, Ewe wrote: Correct me if I'm wrong, is memory leak due to not using delete after a new? Yes. Or using
delete
instead ofdelete[]
for an array made withnew[]
Chun Te, Ewe wrote: Is there a program to check my program for memory leak? 'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good.jhwurmbach wrote: 'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good. Are there any freewares around?
-
Dear all, Correct me if I'm wrong, is memory leak due to not using
delete
after anew
? Is there a program to check my program for memory leak? Thanks Chun Te, Ewethis is one way to cause a memory leak.. another way is to serialize an object array which creates the objects using the word new, and does this everytime the file is loaded.. before serializing an object array you should delete everything in it before loading the objects into it again.. these are a few ways to have memory leaks. -dz
-
jhwurmbach wrote: 'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good. Are there any freewares around?
Not really.... the tools available are really for checking whether you are going past array bounds or accessing memory that hasn't been allocated. VC++ tells you when you have a memory leak and thats about as much help as your going to get anywhere. There are a number of good articles here about how to trace your memory leaks better, look in 'Programming Tips' Asim Hussain e: asim@jawache.net w: www.jawache.net
-
Chun Te, Ewe wrote: Correct me if I'm wrong, is memory leak due to not using delete after a new? Yes. Or using
delete
instead ofdelete[]
for an array made withnew[]
Chun Te, Ewe wrote: Is there a program to check my program for memory leak? 'BoundsChecker' or 'Purify' spring to my mind. Both are big money, but very good.Just being obnoxious: if I'm not mistaking the 'delete[]'-syntax is no longer needed when trying to delete an array. Following code does exactly the same thing twice: void main() { char* s = new char[10]; delete s; char* p = new char[10]; delete []p; }
-
Just being obnoxious: if I'm not mistaking the 'delete[]'-syntax is no longer needed when trying to delete an array. Following code does exactly the same thing twice: void main() { char* s = new char[10]; delete s; char* p = new char[10]; delete []p; }
Have a look at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_Using_delete.asp The following two cases produce undefined results: using the array form of delete (delete [ ]) on an object and using the nonarray form of delete on an array.
-
Have a look at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_pluslang_Using_delete.asp The following two cases produce undefined results: using the array form of delete (delete [ ]) on an object and using the nonarray form of delete on an array.
I stand completely corrected. I was confused with the change from 'delete [n] array' to 'delete [] array'. And I was lucky in the example I gave, because the difference between 'delete [] array' and 'delete array' is that in the latter case no destructors are called while in the former they are. But in my example I was silly enough to use char's, who, obviously, have no destructors at all.