01. [30p] RAM Monitoring

For this task we will use MemoryLeak.sln inside the Task-01 folder.

:!: Using Windows Performance Recorder, run a program (MemoryLeak.exe) that allocates 1MB of memory every 100 milliseconds for a while and then stops. After the program stops, save the capture, open it in Windows Performance Analyzer and analyze the Virtual Memory Snapshots graph. What conclusion can you draw by looking at the memory usage of the process that is running our program?

:!: Using VMMap, inspect the memory spikes generated by running the same program.

:!: Finally, after installing Visual Leak Detector and including the vld.h file to the program, inspect where the allocation took place. What do you observe?

Follow these steps to run the Visual Leak Detector (VLD) successfully:

  1. From Visual Studio, navigate to the Solution Explorer window, right click on the project name and select Properties.
  2. From Configuration Properties menu, select the VC++ Directories option and go to the Include Directories field. Here, you should add the correct path from your machine pointing to the include directory inside the VLD installation directory (it should look like C:\Program Files (x86)\Visual Leak Detector\include).
  3. From Configuration Properties menu, select the Linker option and go to the InputAdditional Dependencies field. Here, you should add the correct path pointing to the vld.lib file (it should look like C:\Program Files (x86)\Visual Leak Detector\lib\Win32\vld.lib).
  4. From the same Linker option, navigate to Debugging and you will observe the Generate Debug Info field. Here, you need to select Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL).

When writing the code, the following functions need to be overwritten: malloc, free, new, and delete. This allows each memory allocation and deallocation to be tracked. All the detected leakages (having an allocation that is not followed by a deallocation) will be saved in a log file that can be viewed after the program stops running.

ep/labs/09/contents/tasks/ex1.txt · Last modified: 2021/12/04 20:06 by andrei.mirciu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0