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.
Info_user100Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

captainkirkCommented:
If you allocated some memory with new(), it remains allocated until you delete() it or the process terminates. If the process terminates without your having called delete(), or you keep on allocating more memory without eventually releasing it, then you have what is known as a "memory leak".
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Info_user100Author Commented:
What if The process is terminated the way I described it?
0
captainkirkCommented:
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....
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Info_user100Author Commented:
Thanks, but can you tell me where that flag is.
0
captainkirkCommented:
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...)
0
Info_user100Author Commented:
Points raised.

Than if I didnt see the window that you mention can it release without me even knowing it released it?
0
nietodCommented:
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.
0
captainkirkCommented:
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...
0
nietodCommented:
   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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.