Re: Memory problems (possibly very easy question)
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 19:48:46 -0500
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:
Joseph M. Newcomer [MVP]
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?
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: checkbox caption placement
- Next by Date: Re: How about the future of VC++/MFC
- Previous by thread: Re: Memory problems (possibly very easy question)
- Next by thread: how to invoke the javascript function from activex
- Index(es):
Relevant Pages
|