Tuesday, May 8, 2018


New Feature & Memory Leak Fix in GInput
Date: Monday 3/19/18
Author: Tyler Murray
The second week of Final project, my goal is to implement support for Direct2D/BGRA into the GDirectX11Surface and fixed the memory-leak in Ginput’s init function. The users where getting memory leaks that were their fault. Also, some other users want to use Direct2D and we don’t support it with our GDirectX11Surface.
After doing some research I was able to support Direct2D by adding the BGRA & VIDEO SUPPORT flags to the deviceFlag and adding a flag to the initMask structure. (Used to determine what features you want when you call the init function) Then I written a section of the GDirectX11Surface Unit test to test if the Direct2D support works. After running the unit test it will open a window a draw a circle.
GInput’s Memory leak problem was caused by not freeing the memory allocated before the end of the function. There was malloc() without a following Free(). After this simple fix the memory leak in GInput’s init function has been dealt with. 


Hunting Memory Leaks (Windows)
Date: Monday 3/19/18
Author: Tyler Murray
The third week of Final project, my goal is to locate and clean up all memory leaks on the Windows side of Gateware. The problem is going to have to be pin-pointing actually where they are and what are causing them. I need to do some research on tips of tracking Memory leaks and the CRT Library.
After doing a bit of research I was able to use the CRT Library and a bit of code to detect how many memory leaks are present. I excluded all unit tests, then started adding one at a time back into run against the Memory leak detection code. I was able to narrow it down to the following Libraries. GLog, GOpenGLSurface, GWindow, and GDirectX11SurfaceTest. Most of the memory leaks were caused in the unit test either not decrementing refCount correctly or having a creation function in a TEST CASE with multiple SECTIONS thus the creation function was called more than once and had no pointer assigned to the allocated memory. GLog and GOpenGLSurface where the only ones where I had to fix the issue in the Library itself. GLog’s Custom Creation function didn’t clean up it memory if it was a fail case. GOpenGLSurface’s refCount wasn’t atomic and had no incrementation call for gWnd in its SetGWindow().


No comments:

Post a Comment