OpenCV application optimized
Now that the OpenCV application has been optimized and should no longer have memory leaks, its time to verify this by collecting another trace. Here the same steps are performed as before and the application's run time behavior is exactly the same as before, the differences won't be obvious until inspection of the trace in the WIndows Performance Analyzer.
- [Narrator] In the Exercise Files folder for this video,…double click on the folder BlendBitmaps_Optimized.…Once again, if you don't have access to the exercise files…and you're following along…with your own Visual Studio solution,…you'll want to rebuild the solution…so the changes you made to BlendBitmaps…using safe_release take effect.…But, just so it's clear…which version we are looking at here,…I'm going to delete the BlendBitmaps shortcut…we currently have on our desktop.…For those of you following along in your own solution,…your release binary will still be called…BlendBitmaps.exe,…but follow along with me…and recreate your own shortcut…so we are all on the same page.…
So, let's recreate the shortcut,…but this time for our new and improved version.…We're going to locate the Bin\Win32\Release binary,…and collect memory usage data for this new version…that releases memory that's no longer being used.…WPA will show us whether the changes we made…are actually effective.…Now that we're instead the BlendBitmaps_Optimized folder,…
Diagnosing application performance problems on a PC can feel like you have to be one part detective and one part psychic. Your application may compile and run fine—until boom, it crashes. These crashes are usually caused by memory leaks: poorly managed resource allocations in the application. Luckily, with Windows Performance Toolkit, you can locate and correct problems such as memory leaks quickly and efficiently. Thomas Pantels, former application engineer at Intel, shows how to analyze and optimize applications with memory leaks using Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA). He drills into an OpenCV application developed in C++, walks through the source code, and fixes the leak, providing a thorough overview of Windows Performance Toolkit in action and practical techniques that will help your applications make better use of system resources.
Gathering memory leak evidence
Installing the Windows Performance Toolkit
A brief introduction to OpenCV
An OpenCV application with memory leaks
Heap, pool, and VirtualAlloc uses
Gathering memory leak evidence: Setup
Gathering memory leak evidence: Collection
Memory leak investigation: Part 1
Memory leak investigation: Part 2
Challenge: Where to release memory
Solution: cvReleaseImage placement
Optimized OpenCV application inspection
Video: OpenCV application optimized
OpenCV application optimized
Now that the OpenCV application has been optimized and should no longer have memory leaks, its time to verify this by collecting another trace. Here the same steps are performed as before and the application's run time behavior is exactly the same as before, the differences won't be obvious until inspection of the trace in the WIndows Performance Analyzer.
- [Narrator] In the Exercise Files folder for this video,…double click on the folder BlendBitmaps_Optimized.…Once again, if you don't have access to the exercise files…and you're following along…with your own Visual Studio solution,…you'll want to rebuild the solution…so the changes you made to BlendBitmaps…using safe_release take effect.…But, just so it's clear…which version we are looking at here,…I'm going to delete the BlendBitmaps shortcut…we currently have on our desktop.…For those of you following along in your own solution,…your release binary will still be called…BlendBitmaps.exe,…but follow along with me…and recreate your own shortcut…so we are all on the same page.…
So, let's recreate the shortcut,…but this time for our new and improved version.…We're going to locate the Bin\Win32\Release binary,…and collect memory usage data for this new version…that releases memory that's no longer being used.…WPA will show us whether the changes we made…are actually effective.…Now that we're instead 
the BlendBitmaps_Optimized folder,…
Diagnosing application performance problems on a PC can feel like you have to be one part detective and one part psychic. Your application may compile and run fine—until boom, it crashes. These crashes are usually caused by memory leaks: poorly managed resource allocations in the application. Luckily, with Windows Performance Toolkit, you can locate and correct problems such as memory leaks quickly and efficiently. Thomas Pantels, former application engineer at Intel, shows how to analyze and optimize applications with memory leaks using Windows Performance Recorder (WPR) and Windows Performance Analyzer (WPA). He drills into an OpenCV application developed in C++, walks through the source code, and fixes the leak, providing a thorough overview of Windows Performance Toolkit in action and practical techniques that will help your applications make better use of system resources.
Gathering memory leak evidence
Installing the Windows Performance Toolkit
A brief introduction to OpenCV
An OpenCV application with memory leaks
Heap, pool, and VirtualAlloc uses
Gathering memory leak evidence: Setup
Gathering memory leak evidence: Collection
Memory leak investigation: Part 1
Memory leak investigation: Part 2
Challenge: Where to release memory
Solution: cvReleaseImage placement
Optimized OpenCV application inspection
Video: OpenCV application optimized