Re: memory not released by delete[] operator
"RocketRob" wrote:
One thing I've noticed which is very curious: If I let
the app run for a
bit and let it grab memory doing its things.... if I then
MINIMIZE it... all
of the memory resources are freed at that point.
Immediately.
So, now what I need to figure out is what is happening on
the MINIMIZE event
that could free all of this memory.
Oh, it seems you check memory usage with Task Manager, do
you? Taks Manager is not the right tool for this job. It
doesn't show the memory you allocate. It shows current
memory working set of a process. Process working set is a
set of memory pages your process ever touched but system
didn't reclaim it back yet. System keeps these pages in
process working set in case process will require them soon,
so allocation will spare a page fault.
When application's main window is minimized, then system
assumes that user won't use this process for some time, so
its working set is trimmed to absolute mimium required by
the process.
Read here more about working set:
"Process Working Set"
http://msdn2.microsoft.com/en-us/library/ms684891.aspx
If you need to measure actually allocated memory, then use
Performance Management Console (Control Panel ->
Administrative Tools -> Performance). Select "Process"
performance object, then choose a process you want to
monitor. From counters list select "Private bytes" counter.
Alex