Re: Memory problems (possibly very easy question)



It depends on whether the size reported is the total memory footprint or the working set
size. Generally, none of these numbers are really trustworthy.
joe

On Tue, 28 Nov 2006 20:55:47 GMT, Dan Bloomquist <public21@xxxxxxxxxxx> wrote:


Interesting. On my machine:

404MB
TC tc;
for( long i= 0; i < 2000000; ++i )
tc.push_back( new CTest );
540MB
for( ITC it= tc.begin( ); it != tc.end( ); ++it )
delete *it;
413MB
{
TC temp;
temp.swap( tc );
}
404MB

Best, Dan.


hamishd wrote:

Hello,

In my application I create some large vectors to hold data. For
example:

std::vector<DataItemClass*> MyData;
DataItemClass * DataItem;

for(i=0;i<SomeLargeLimit;i++){
DataItem = new DataltemClass;
MyData.push_back(DataItem);
}


So while my application is running, I can watch in the "Windows Task
Manager" under "Processes" my application's mem usage increase as I
allocate more memory. Eg, say to 150,000KB.

How do I release this memory?

I go:
for(i=0;i<MyData.size();i++)
delete(MyData[i]);
MyData.clear();

But my mem usage does not reduce... so when i run the process a few
times the usage gets really really large, and windows gives me virtual
memory usage warnings (or similar).

When I run the application in debug mode, the same thing occurs, and i
can confirm the "delete" operations are being executed. MSVC++ 6.0 does
not show any memory leaks, so why is my memory usage not clearing?

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: SBS 2003 Premium R2 server becomes more unstable, page file gr
    ... high CPU usage. ... The server hasn't crashed yet, but it has in the past. ... virtual memory or similar errors, I'd see if the instability is remedied, ... Image Name PID Username Session ID CPU Mem Usage Peak Mem Usage ...
    (microsoft.public.windows.server.sbs)
  • Re: SBS 2003 Premium R2 server becomes more unstable, page file gr
    ... virtual memory or similar errors, I'd see if the instability is remedied, ... Image Name Mem Usage VM Size ... Image Name PID Username Session ID CPU Mem Usage Peak Mem Usage ... Les Connor [SBS MVP] ...
    (microsoft.public.windows.server.sbs)
  • Re: CPU Pegged at 100%
    ... Did you disable McAfee and Windows Defender before running Housecall? ... Even when a programme with a memory leak is ... You can check pagefile usage more directly using pagefilemon. ... The basis of your complaint is that CPU is pegged at 100%. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: CPU Pegged at 100%
    ... Enquire, plan and execute ... mtvet wrote: ... Even when a programme with a memory leak is closed the ... You can check pagefile usage more directly using pagefilemon. ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: CPU Pegged at 100%
    ... Enquire, plan and execute ... Even when a programme with a memory leak is closed the ... You can check pagefile usage more directly using pagefilemon. ...
    (microsoft.public.windowsxp.perform_maintain)