Link to home
Start Free TrialLog in
Avatar of Info_user100
Info_user100

asked on

Debug and operator new

I am testing a utility in debug mode of
VC6. In the program I allocate some space from heap with new, But I dont follow the program to the end whre I
delete [], I stop the debug mode
with allocated memory. I want to
know if the memory allocated stays until I shot the computer or it releases when I stop debug mode.


Thank you.
This is important for me to know.
ASKER CERTIFIED SOLUTION
Avatar of captainkirk
captainkirk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Info_user100
Info_user100

ASKER

What if The process is terminated the way I described it?
same issue - if you stop debugging before the memory is released to the system, the debugger will flag this as a memory leak -- in other words, it remains allocated....
Thanks, but can you tell me where that flag is.
When you stop the debug session, if there are memory leaks, the output window will say:

"Detected Memory Leaks!"

and proceed to dump all objects that you have allocated without releasing...
(I'm talking about Visual C++ 6.0, now...)
Points raised.

Than if I didnt see the window that you mention can it release without me even knowing it released it?
Except you must turn that feature on.  by default it does not warn you of memory leaks.  So if you have not turned the feature on you will not see the leaks reported, even if there are some.
nietod - this feature is already turned on (at least in VC++ 6.0) when building a debug target project... I have never had to do any special manipulations to get the dump... when debug is defined, mapping takes place to debug versions of memory management routines and everything. I'm curious why you have to do all this extra setup...
   In VC 5 it definitly was not on by default.  i guess I never tested that in VC 6.  However, i'm not completely convinced you're right.  Do you use MFC?  MFC turns it on.  You have to test it by creating a leak in a non-MFC app to be sure.