|
-
February 23rd, 2009, 02:15 AM
#1
Memory leak or not memory leak?
Hi!
I currently looking for memory leak in my application. After I found out one operation that seems to make a memory leak from the task manager, I decided to test one thing (since I know I can't trust the task manager information).
I created 3 small windows applications by using the project wizard of visual studio 2008, using default settings.
In the first application, I do nothing else, just run it - pretty simple.
In the second application, I just add at the end of the "InitInstance" member function of my class application the following lines:
BYTE **up_info = new BYTE *[80000];
for (int i=0; i<80000; i++) up_info[i] = new BYTE[512];
for (int i=0; i<80000; i++) delete[] up_info[i];
delete[] up_info;
In the third application, I did the same thing than for the second application with adding a loop on this memory allocation/deallocation a big number of time.
I believe that my code does not have memory leak. Tell me if I am wrong.
After the memory allocation/desallocation has been finished for each of the 3 applications, I checked the memory information through the Process Explorer application.
Here are the information:
Type of memory / First Application / Second Application / Third Application
Working set / 15,584 K / 19,180 K / 50,324 K
WS Private / 3,428 K / 7,020 K / 38,152 K
WS Shareable / 12,156 K / 12,160 K / 12,172 K
WS Shared / 10,912 K / 10,896 K / 10,912 K
Private Bytes / 4,632 K / 8,160 K / 39,408 K
Virtual Size / 118,644 K / 165,364 K / 197,748 K
Peak Private Bytes / 8,688 K / 47,580 K / 49,412 K
Peak Working set / 19,572 K / 55,896 K / 57,396 K
In case of the third application, the memory is increasing until stabilizing to a certain value. I stopped the loop when the memory usage was stable in the Task manager.
So here are my questions:
Since I truely believe that my code doesn't generate memory leaks, why does the private bytes has increased so much in the case of the third application?
How can I read all theses memory values to determine whether I have a memory leak or not?
During the loop of the third application, the number of page fault is increasing a lot. Why?
Thanks for you time,
madric
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|