GAudio Bugs Crushed and Now Back to Memory Leak Detection
Date: 5/21/2018
Author: Tyler Murray
The previous week I manage to narrow down and discover the cause of the bug that caused the "pause" & "resume" functions on Linux's GAudio side to fail/crash. In the functions they are using a function from PusleAudio to pause and resume the stream. But this function returns an operation of which wasn't being accounted for. Second reason is that there is a structure that handles these "operations" but these structures are only created within the scope of the function so when a function end that structure is out of scope. So overall, in the streamSound loop was never getting notified that a sound is being paused or resumed so it continued as so, but the stream would still pause/resume. Which caused the application to stall out. Making the structure declared once as a global and assigning it operation member appropriately fixed this problem.
My goal/plan this week is to finish to Linux memory leaks. As of right now I managed to clean all of them except the ones that are within GAudio. This is good news and bad news at the same time because for some reason Valgrind, my Linux memory leak detector is having problems when I run it with GAudio's unit tests. This week is going to be interesting, hopefully I can solve the problem, if not I will have to find another means of memory leak detection.
The purpose of Gateware is to create lightweight, multi-platform libraries that handle functionality common to video games. At the moment this includes keyboard and mouse input libraries and file logging libraries. The intent is for current and future students to be able to utilize these libraries to aid them in the creation of their final projects. The current deployments for the libraries are the Windows, Mac, and Linux platforms.
Monday, May 21, 2018
Monday, May 14, 2018
GAudio Bugs on Linux
Date: 5/14/2018
Author: Tyler Murray
The previous week I was able to fix the bugs related to GAudio & GFile on Windows side. Now getting ready for the release process I encountered bugs that formed on Linux side do to the fixes I made. This will prevent me from continuing the release process until all bugs related to GAudio & GFile on Linux, Mac, & Windows are fixed.
My plan is to use GitKraken to show me the differences between commits so I can narrow down what added code caused the problem on Linux. Once Linux side is fixed, I will have move to mac side, run the unit tests, and fix any bugs that show up. Finally go back to windows to check if the changes to mac & Linux caused any problems. Basically any changes done to one side I must recheck all sides.
After this release, my next task will to go back to fixing Linux memory leaks.
Date: 5/14/2018
Author: Tyler Murray
The previous week I was able to fix the bugs related to GAudio & GFile on Windows side. Now getting ready for the release process I encountered bugs that formed on Linux side do to the fixes I made. This will prevent me from continuing the release process until all bugs related to GAudio & GFile on Linux, Mac, & Windows are fixed.
My plan is to use GitKraken to show me the differences between commits so I can narrow down what added code caused the problem on Linux. Once Linux side is fixed, I will have move to mac side, run the unit tests, and fix any bugs that show up. Finally go back to windows to check if the changes to mac & Linux caused any problems. Basically any changes done to one side I must recheck all sides.
After this release, my next task will to go back to fixing Linux memory leaks.
Tuesday, May 8, 2018
A New Bug & Linux fixes
Date: 5/7/2018
Author: Tyler Murray
The first week of the third month of final project, my goal
was to work on fixing the memory leaks on Linux side. I manage to fix two
errors on Linux side before a team has report bugs in GAudio. The two fixes I
made are related to structures not being “zeroed-out” before using them. Now
switching to a new branch to focus on fixing the GAudio bugs and pushing a new
release as soon as possible. The reported bugs are
- Master Volume is never initialized.
- Calling stopStream() after calling pauseStream() causes the app to stall.
- No documentation on what index is what channel in all SetChannel-like functions.
At the end of the first week I got “bug” 1 & 3 done
pretty quickly but bug 2 on the other hand took me a bit to narrow it down. I
figured out that the pauseStream() calls a XAudio2 func to stop the stream and
if the stream is stopped it never seems to exit the while loop in the
streamThread. So far, my current fix for the problem is to call the XAudio2
func to start the stream if the stream is stopped. This fix allows it to exit
the while loop thus making it exit the loop. Now all is left to do is to double
check if the audio truly stops when the stop function is called. My goal for
this week is to finish up the GAudio “bugs”, update the doxygen documentation
since I added more comments in the code, and push out a release with the fixes.
Then after the release return back to the master branch and work on Linux
memory leaks again.
Direct2D_Support bug fix & problems on Mac
Date: 4/16/18
Author: Tyler Murray
End of the second week of month two. My goal is to fix the DIRECT2D_SUPPORT
bug where it prevented the user from using the graphics debugger. Mid-Linux bug
fixes I had to switch gears to windows side into it GDirectXSurface. After
getting the bug fixed I have to then do a release which entails making sure all
platforms pass the unit tests. Which has lead me to my current problem now. Mac
side is getting a crash when running the test so this week I’ll have to track
the source of this problem and fix it then move to Linux fix that and then
finally do a release.
Finding the Direct2D_Support bug wasn’t hard since it was
little code to look through and figured it out quickly it was an additional
device flag being set that caused the problem. After fixing Window side still
was able to run and pass all unit tests. Now on Mac side it failed the unit
tests, and my plan is to go to the previous commits one-by-one to find where
the error first occurred and track it down that way.
Problems on Linux
Date: 4/09/18
Author: Tyler Murray
Second week of month two. My goal is to fix any errors on
the Linux side and then locate and clean up any memory leaks found. The problem
I’m facing is running Linux side normally and with memory leak detector
(Valgrind) it outputs different results. Normally it shows it passes each test
but with Valigrind it fails some.
So, prior to this week I fixed the problems on the debug
side of Linux that was causing failure in the unit tests. There was an allocation
with memcpy() to a double void ptr which caused problems to come later in the
unit tests. Another problem was a thread error where the bool used to exit the
thread loop wasn’t being changed when the thread was “done”. Fixing this allows
me to run it with Valgrind which shows 2 errors, both in GAudio when using the
filepaths given in the unit tests. Valgrind also states that there are 87 leaks
in the project. My goal this week to look into the filepath errors in GAudio
and see if fixing them reduces the number of leaks. I’ll will be doing more
research in Valgrind, and Linux-side filepaths.
Hunting Memory Leaks (Mac)
Date: 3/27/18
Author: Tyler Murray
First week of the 2nd month of Final Project. My
goal is to locate and clean up any memory leaks found on the Mac side of
Gatware. The problem that going to come up is learning another coding language
(Objective-C), Find code or some way to help me locate the memory leaks, and
what is causing the leaks.
After doing some research I learned the very basics of
Objective-C which will allow me to go through and understand what is going on.
Also while doing my research I came to a solution of what I can use to help me
locate the memory leaks on the Mac side. When you run Gateware on profiling
(aka Debug mode) It will bring up an application called instruments which has a
variety of tools you can use while debugging. One of those tools being “Leaks”
of which you guess it, helps you locate memory leaks in your program. After
giving that a run I was able to see five memory leaks. As of right now I was
able to clean-up four out of the five memory leaks. Three being within GAudio
and one being in GWindow’s unit test.
The last one is still a mystery since it says it
NSAutoreleasePool related. I checked all the pools being created and all of
them are being drained (aka freeing the memory). For the rest of this week I’ll
be doing some more research on NSAutoreleasePools and Objective-C memory
management to hopefully help me narrow were this problem is coming from.
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().
Monday, May 7, 2018
Previous Blog Location
Hi Everyone,
This is the new blog that Gateware Developers will use to talk about their progress in the project, the previous blog used by developers can be found here.
This is the new blog that Gateware Developers will use to talk about their progress in the project, the previous blog used by developers can be found here.
Subscribe to:
Posts (Atom)